cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: UIDocumentPicker cache

UIDocumentPicker cache

Michael T.82
New member | Level 1

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 3

Greg-DB
Dropbox Staff

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
New member | Level 1

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
Dropbox Staff

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

Need more support?