Dropbox iOS authentication

I am adding Dropbox support to my iOS app. Using the official Dropbox API and online tutorials here I got to the point where Dropbox needs to be authenticated. Below is the code that Authenticate provides when the button is clicked:

@implementation CryptoMainViewController
#pragma mark - Dropbox
- (void)didPressLink {
    if (![[DBSession sharedSession] isLinked]) {
        [[DBSession sharedSession] link];


But no matter how I change the code, where I put it, or which button I link it to, nothing happens. Using breakpoints, I found that the method actually works. I even put it in IBAction, but it gives the same result. What am I doing wrong? How can I get my app to authenticate the end user?

And, after authenticating, How can I save the NSString for the Dropbox user?

If this is just completely wrong, then where can I find resources on how to get it right?

All tutorial, all documentation, api, etc. available here .


source to share

3 answers

I had the same problem; the reason is that I haven't set up a shared Dropbox session for example.

DBSession* dbSession = [[[DBSession alloc] initWithAppKey: @"your_app_key"
                                           appSecret: @"your_app_secret"
                                           root: kDBRootAppFolder] autorelease];
[DBSession setSharedSession: dbSession];


Once it's called, the link works fine.



this answer may be overdue, but I am assuming you have linked your application before and want to do it again. The only way you can link the connection process again is by running the following code: [[DBSession sharedSession] unlinkAll]; You can put it in your viewDidLoad. When you call didPressLink: the app should open the Dropbox app (if available), safari or app window asking for your permission to access your Dropbox. If it doesn't, the problem is elsewhere. Hope it helps



Is it implemented in your view <DBLoginControllerDelegate>


If so, connect Dropbox like this:

DBLoginController* controller = [[DBLoginController new] autorelease];
        controller.delegate = self;
        [controller presentFromController:self];




All Articles