Forum Discussion

sipho's avatar
sipho
Explorer | Level 3
9 years ago

API for iOS

Dropbox doesnt authenticate successfully when dropbox app is installed on your device.

 

I'm using DropBox SDK for iOS.

 

After allowing the DropBox app to authenticate my app, the screen goes blank - but i log in succeesfully when I dont have dropbox app installed in my device.

4 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

    - the name and version of the platform and SDK/library you are using
    - the full text of any error or output, or a screenshot showing the issue
    - the steps to reproduce the issue
    - the relevant code snippet(s)
  • sipho's avatar
    sipho
    Explorer | Level 3
    9 years ago
    Hi Greg,

    Thank you for your quick reply.

    I'm developing an app that I want to use to access files from Original Dropbox App from my app.

    Ive managed to successfully get authorized by the Original Dropbox webview, but when I install the Original Dropbox in my device - It opens the Original Dropbox app for authorization and after allowing it to authorize, the screen goes blank and app delegate method is not triggered. Below is my code.

    //Login method
    - (void) viewDidLoad {
    DBSession *dbSession = [[DBSession alloc] initWithAppKey:kDBAppKey
    appSecret:kDBAppSecret
    root:kDBRootDropbox];
    [DBSession setSharedSession:dbSession];

    if (![[DBSession sharedSession] isLinked]) {

    [[DBSession sharedSession] linkFromController:self];
    } else {

    [self showActivityHud:@"Retrieving files from DropBox..."];
    [[self restClient] loadMetadata:@"/"];
    }
    }

    //AppDelegate method that is not triggered ONLY if the Original Dropbox app is installed in my device.
    - (BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

    if ([[DBSession sharedSession] handleOpenURL:url]) {

    if ([[DBSession sharedSession] isLinked]) {

    NSLog(@"App linked successfully");

    [[NSNotificationCenter defaultCenter] postNotificationName:@"getDropboxRoot" object:self];
    _isDropBoxCancelled = NO;
    } else if ([[url absoluteString] containsString:@"cancel"]){

    [[DBSession sharedSession] linkFromController:nil];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"dropboxRegistrationCancel" object:self];
    _isDropBoxCancelled = YES;
    }
    }
    }

    //In simple terms...My Simulator works perfect because it doesnt have Original Dropbox app installed in it.

    //My iPhone doesnt work since there is Original DropBox app installed.

    Thank you.
  • sipho's avatar
    sipho
    Explorer | Level 3
    9 years ago
    Hi Greg,

    I fixed the problem.

    I changed LSApplicationQueriesSchemes to dpapi-1. Then it worked.

    Thank you for your time man. I appreciate it.

About Dropbox API Support & Feedback

Node avatar for 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!