Skip to main content
Question

any documentation for Swift developers??

  • May 21, 2025
  • 3 replies
  • 29 views

Forum|alt.badge.img

The BOX developer content is very fragmented and confusing, especially for new developers.  Does any one know where I can find tutorials or documentation for BOX integration in an iOS 10 app in Swift?  i've looked all over and cant find any thing. Thanks in advance

3 replies

Forum|alt.badge.img

 Unfortunately, we don't have documentation in Swift for building a Box integration. We have an iOS SDK and documentation for it, but it is in Objective-C.


Forum|alt.badge.img

Ok still having a problem downloading a file.  I'm getting a 404 error "not found", but the file is in my BOX.  Is the ID parameter supposed to be the name of the file I'm trying to download? I thing this is where by issue lies.  Any help would be much appreciated.  heres my code:

 

let contentClient = BOXContentClient.default()
            let localFilePath: String = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("savedClients.data").absoluteString
            let boxRequest: BOXFileDownloadRequest? = contentClient?.fileDownloadRequest(withID: "savedClients.data", toLocalFilePath: localFilePath)
            boxRequest?.perform(progress: {(_ totalBytesTransferred: Int64, _ totalBytesExpectedToTransfer: Int64) -> Void in
                // Update a progress bar, etc.
            }, completion: {(_ error: Error?) -> Void in
                // Download has completed. If it failed, error will contain reason (e.g. network connection)
                if error == nil {
                    if let savedClientsData = FileManager.default.contents(atPath: localFilePath) {
                        if let model = NSKeyedUnarchiver.unarchiveObject(with: savedClientsData) as? [ClientModel] {
                            self.savedClients = model
                            self.navigationItem.rightBarButtonItem?.isEnabled = true
                            self.navigationItem.rightBarButtonItem?.tintColor = UIColor.black
                        }
                    }
                } else {
                    print("BOX error: \(String(describing: error))")
                    let errorAlert = UIAlertController(title: "Error", message: "There was and error downloading Queue list.\n\(String(describing: error))", preferredStyle: .alert)
                    let dismiss = UIAlertAction(title: "Dismiss", style: .default, handler: nil)
                    errorAlert.addAction(dismiss)
                    self.present(errorAlert, animated: true, completion: nil)
                }
            })

Forum|alt.badge.img

Hi Murtza,

 

Can the iOS SDK initialize BoxClients with access tokens derived from the auth JWT protocol?