You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
joejjank
6 years agoHelpful | Level 6
Mixing Swift and Objective C
I have an application that was first developed for the IPhone and then added support for mac os. Much of this has been developed in Objective C - this is all working fine. As I add new functions I ...
- 6 years ago
Ok - thanks for the feedback. I have some common Objective C in a class that I can call from Swift so that works fine. So until I convert the entire application to swift I can live with that restriction.
Greg-DB
Dropbox Staff
The SDKs weren't designed with the intention that a single app would use both of them, but I can't say off hand if doing so would or wouldn't cause issues. I don't believe we've explicitly tested that.
You generally can import Objective-C into Swift though. Here's Apple's documentation for doing so:
And here's an old Dropbox blog post that covered how to do so, albeit for an older, now retired SDK:
https://blogs.dropbox.com/developers/2014/09/swift-apps-with-dropbox/
(For the API v2 Objective-C SDK, the import statement is instead "#import <ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.h>".)
If you can get that to work for your app, that might be better, for the sake of simplicity.
In any case, based on the additional code/context you shared here, I think the specific issue you're seeing is just due to the "client" variable going out of scope, since it's only defined in "viewDidLoad". Try moving that out of "viewDidLoad" so that it won't get cleaned up before the API call completes.
joejjank
6 years agoHelpful | Level 6
Ok - thanks for the feedback. I have some common Objective C in a class that I can call from Swift so that works fine. So until I convert the entire application to swift I can live with that restriction.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,883 PostsLatest Activity: 11 hours agoIf 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 or Facebook.
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!