Forum Discussion

Michael T.82's avatar
Michael T.82
New member | Level 1
10 years ago

UIDocumentPicker cache

I'm successfully using UIDocumentPicker and can download and open a file in iOS.

However, If I upload a changed file to the web (via pc) and then download it again into iOS it still finds the old version. It does this for about an hour, then if I'm luck it finds the new one. Another PC with the same dropbox account syncs the file almost immediately.

Is there some sort of cache that I need to disable when using UIDocumentPicker or something else that might cause this?

 

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    Can you share the relevant code snippet(s) and a sample link so we can check on this for you? Thanks in advance! 

  • Michael T.82's avatar
    Michael T.82
    New member | Level 1
    10 years ago

    This is the code I'm using ...

     

    func importDatabase(view: UIViewController!, sender: AnyObject, activityIndicator: UIActivityIndicatorView) {
            self.view = view
            self.activityIndicator = activityIndicator
            let importMenu = UIDocumentMenuViewController(documentTypes: ["com.michaeltissington.uti.awdb"], inMode: .Import)
            importMenu.delegate = self
            importMenu.popoverPresentationController?.barButtonItem = sender as? UIBarButtonItem
            importMenu.popoverPresentationController?.sourceView = view.view
            view.presentViewController(importMenu, animated: true, completion: nil)
        }
        
        func documentMenuWasCancelled(documentMenu: UIDocumentMenuViewController) {
            documentMenu.dismissViewControllerAnimated(true, completion: nil)
            activityIndicator.stopAnimating()
        }
        
        func documentMenu(documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
            documentPicker.delegate = self
            activityIndicator.startAnimating()
            view.presentViewController(documentPicker, animated: true, completion: nil)
        }
        
        func documentPickerWasCancelled(controller: UIDocumentPickerViewController) {
            activityIndicator.stopAnimating()
        }
        
        func documentPicker(controller: UIDocumentPickerViewController, didPickDocumentAtURL url: NSURL) {
            mergeDatabase(url)
            activityIndicator.stopAnimating()
            let fileManager = NSFileManager.defaultManager()
            try! fileManager.removeItemAtURL(url)
        }

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    Thanks! I'm sending this along to the right people to look into it.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!