cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: Using Sync API to open files when already open

Using Sync API to open files when already open

Stuart T.
New member | Level 1

I'm using the iOS Sync API to load in image files and grab there contents and display them in a scroll view. As the user scrolls it loads and unloads images. But I see that once you open a file you cannot open it again. So I am getting errors when it tries to load again. I don't really need to keep the files open, but I cannot find a way to close them, or grab an already open file.

What is the best practice for this? Should I just keep a dictionary of files and there paths? I was trying this but running into memory issues.

  • (DBFile )openFile:(DBPath *)path error:(DBError *)error; // I'm using this function and calling it in a block via: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
2 Replies 2

Greg-DB
Dropbox Staff

You probably will want to close any files you don't need to keep open. For reference, you can close a DBFile using the close method, documented here:

https://www.dropbox.com/developers/sync/docs/ios#DBFile.close

Stuart T.
New member | Level 1

Yes! How did I miss that? I was looking everywhere for close. I must've just been looking for it in DBFilesystem. Thanks for pointing out the obvious 🙂

Need more support?