cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Can't import Dropbox API into Swift

Can't import Dropbox API into Swift

Dan T.8
New member | Level 1

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 5

Jay H.14
New 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.8
New member | Level 1

That's essentially what I have in my AppDelegate, but Xcode can't find DBAccountManager.

Jay H.14
New member | Level 1

The network.startNotifier() method in my code sample above, BTW, has nothing to do with Dropbox

Jay H.14
New 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.8
New member | Level 1

I apparently had two bridging header files, so I just needed to delete the duplicate one. Thanks!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Dan T.8 New member | Level 1
  • User avatar
    Jay H.14 New member | Level 1
What do Dropbox user levels mean?