J_D J_D - 1 year ago 76
iOS Question

Dropbox SDK for iOS - Detecting a login cancel

I am starting to use the DropBox SDK for iOS, and I saw that the code to detect if the login was successful or not is something like this:

in AppDelegate:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
if ([[DBSession sharedSession] isLinked])
// Success
// Failed
return YES;

In the case of a failure, how can I identify the cause? I would like to at least distinguish between an error and a cancel.

Answer Source

To identify the Cancel

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

    NSArray *components = [[url path] pathComponents];
    NSString *methodName = [components count] > 1 ? [components objectAtIndex:1] : nil;
    if ([methodName isEqual:@"cancel"]) {
        NSLog(@"Dropbox link Cancelled");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download