Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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.
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
}
That's essentially what I have in my AppDelegate, but Xcode can't find DBAccountManager.
The network.startNotifier() method in my code sample above, BTW, has nothing to do with Dropbox
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.
I apparently had two bridging header files, so I just needed to delete the duplicate one. Thanks!
Hi there!
If you need more help you can view your support options (expected response time for a 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!