Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Dan T.8
10 years agoNew member | Level 1
Can't import Dropbox API into Swift
I followed the instructions at https://www.dropbox.com/developers/sync/sdks/ios to setup the SDK and https://blogs.dropbox.com/developers/2014/09/swift-apps-with-dropbox/ to import it into Swift with #import <Dropbox/Dropbox.h>. I get an unresolved identifier error for DBAccountManager in the AppDelegate, so it seems as if the framework isn't being imported. I made sure to add the other required frameworks. The Dropbox framework file is inside the project folder, and I created the URL scheme.
5 Replies
Replies have been turned off for this discussion
- Jay H.1410 years agoNew member | Level 1
Hmmm. Not sure if it will help or not, but here's my AppDelegate code...
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch./***** code added to support DropBox integration *****/ var accountManager = DBAccountManager(appKey: <myKey>, secret: <mySecret>) DBAccountManager.setSharedManager(accountManager) network.startNotifier() return true } /***** code added to support DropBox integration *****/ func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool { var account = DBAccountManager.sharedManager().handleOpenURL(url) if account != nil { return true } return false } - Dan T.810 years agoNew member | Level 1
That's essentially what I have in my AppDelegate, but Xcode can't find DBAccountManager.
- Jay H.1410 years agoNew member | Level 1
The network.startNotifier() method in my code sample above, BTW, has nothing to do with Dropbox
- Jay H.1410 years agoNew member | Level 1
Then that sounds like something in the Build settings. You've got #import <Dropbox/Dropbox.h> in the bridging header...I assume the naming of the bridging header follows Apple's convention. You might try to import another objC header in your bridging header and just make sure it is, in fact, bridging. And if you open up the Dropbox.framework file in your project, do you see a Headers folder with 19-20 .h files in it, including DBAccountManager? An in your Target, General settings you have Dropbox, QuartzCore, SystemConfiguration, CFNetwork, and Security? (Some of these might not be needed for Dropbox, but it's what I'm using.) There could also be a build setting you need to turn on, but I'm not sure which one.
- Dan T.810 years agoNew member | Level 1
I apparently had two bridging header files, so I just needed to delete the duplicate one. Thanks!
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!