cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

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

Re: UIDocumentPicker cache

Greg-DB
Dropboxer

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

Re: UIDocumentPicker cache

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)
    }

Re: UIDocumentPicker cache

Greg-DB
Dropboxer

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

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    Michael T.82 New member | Level 1
What do Dropbox user levels mean?
Need more support?