We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Mark R.5
9 years agoHelpful | Level 5
Objective-C V2 SDK thread safety
I am just in the middle of implementing a syncing solution using the Obj-C V2 SDK.
I have a couple of concurrent threads. One for checking for (and downloading) any remote changes, and another ...
Mark R.5
9 years agoHelpful | Level 5
Hi. Thanks for the response.
I will create a new serial queue and make sure all API calls are dispatched to this queue for the time being. It is not a massive issue since it is relatively easy to workaround using GCD, but it does start to get a bit messy. In my case I want to maintain two separate concurrent threads, one for downloads and one for uploads. Now I also have to offload to a serial queue for the API calls, while keeping the rest of the sync logic on the concurrent queue. This means that I need to add code to wait for the API calls to return. I can do this using a dispatch_semaphore_t and waiting on the callback to complete, but this does start to become difficult to manage the more calls you have. Personally I would rather not have to worry about this and be able to make API calls from any thread.
On a related note, I am also implementing this syncing solution using the dot-net sdk. This is different in that the API methods are generally async and you await them, so evertthing is effectively handled inline on the same thread. Does this framework also have potential thread safety issues, since I have a similar design with two concurrent threads making API calls...
Stephen C.14
Dropbox Staff
9 years agoHey Mark, check out the latest version of the SDK, v.3.0.8. It is now thread-safe. You should be able to make requests from any thread.
Let me know if you run into any issues!
- Mark R.59 years agoHelpful | Level 5
Fantastic! Just to confirm, I manually added the subproject, so to update to 3.0.8 is it at simple as doing:
carthage update --platform iOS
or is there anything else required?
- Greg-DB9 years ago
Dropbox Community Moderator
That depends on what you have specified in your Cartfile. If you have a specific version number or range set, you may need to update that before you call update.
But yes, once you have your Cartfile configured as desired, just run "carthage update --platform iOS" to update. You can then check the console output or Cartfile.resolved file to see exactly what version was installed.- Mark R.59 years agoHelpful | Level 5
Thanks, I have
github "https://github.com/dropbox/dropbox-sdk-obj-c" ~> 3.0.3
in my Cartfile. I only installed Carthage to use this framework so not too familiar with it yet. The 'resolved' file seems to imply that 3.0.8 is now installed, so I think it is all good.
It would be good if the framework could output its version number upon initialisation. I have had problems in the past with accidentally using the wrong versions of libraries and it would be useful and reassuring to get confirmation of the version number at runtime.
I will monitor this version to see how it behaves, but no problems so far.
About 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!