Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

any documentation for Swift developers??

New post

Comments

3 comments

  • Murtza

     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.

    0
    Comment actions Permalink
  • bbongrip

    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)
                    }
                })
    0
    Comment actions Permalink
  • apongos

    Hi Murtza,

     

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

    0
    Comment actions Permalink

Please sign in to leave a comment.