iphoneobjective-ciosdropboxchdropboxsync

iPhone CHDropboxSync crash to home screen after linking account


I'm very new to using dropbox, and am looking for examples of syncing. I found CHDropboxSync and am in process of making the sample app included with the project work.

I'm running into the issue where dropbox "link with dropbox" webpage opens with prompt "ExampleApp wants access to a folder in your dropbox". The folder name appears correct. When I tap the green "Allow" button, the web browser closes and a black screen appears. A second later I see the iPhone's desktop. There are no error messages, but the app does not reopen after linking a dropbox account. What could be causing this issue? Has anyone else encountered such "crash to desktop" kind of issue with CHDropboxSync?

Here are the modifications that I made to the project to make it work:

<dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>db-CORRECT_APP_KEY</string>
            </array>
        </dict>

In the app delegate:

// Dropbox
#warning Put your app-folder-type dropbox keys in here
    DBSession* dbSession = [[[DBSession alloc] initWithAppKey:@"CORRECT_KEY" appSecret:@"CORRECT_SECRET" root:kDBRootAppFolder] autorelease];
    [DBSession setSharedSession:dbSession];  

Thank you for any help!


Solution

  • I solved the problem by: Creating a different dropbox app and updating the project with new key/secret/root folder Implementing a different app delegate method:

    -(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!");
                [CHDropboxSync forgetStatus];
                [[NSNotificationCenter defaultCenter] postNotificationName:@"Linked" object:nil];
                // At this point you can start making API calls
            }
            return YES;
        }
        // Add whatever other url handling code your app requires here
        return NO;
    }