Dropbox integration in iPhone application error 400

I use the excellent GSDropboxDemoApp source code, which integrates Dropbox perfectly into the application. However, after connecting to the Dropbox application, it gives an error while loading the contents of the folder. Below are the codes

I already edited info.plist

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { #warning Potentially incomplete method implementation. Fill in your Dropbox credentials! #warning NB: you must also update the URL scheme listed under the CFBundleURLTypes key in GSDropboxDemoApp-Info.plist NSString *dropboxAppKey = @"sxxxxxxxxxx"; NSString *dropboxAppSecret = @"cxxxxxxxxx"; NSString *dropboxRoot = @"kDBRootAppFolder"; // either kDBRootAppFolder or kDBRootDropbox DBSession* dbSession = [[DBSession alloc] initWithAppKey:dropboxAppKey appSecret:dropboxAppSecret root:dropboxRoot]; [DBSession setSharedSession:dbSession]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.viewController = [[GSViewController alloc] initWithNibName:@"GSViewController" bundle:nil]; self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; } - (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 to Dropbox successfully"); } else { NSLog(@"App not linked to Dropbox!"); } return YES; } return NO; } 

Error message

  GSDropboxDemoApp[4674:907] [WARNING] DropboxSDK: error making request to /1/metadata/kDBRootAppFolder - (400) Expected a root of either 'dropbox' or 'sandbox', got 'kDBRootAppFolder' 
+4
source share
2 answers

You must use a constant, for example:

 NSString *dropboxRoot = kDBRootAppFolder; // either kDBRootAppFolder or kDBRootDropbox 

Constants are used so that you do not need to worry about the actual value itself.

+8
source

And for those of us (in the future who stumble over this issue), getting the same mistake using the ruby ​​movement, this should be:

 dropboxRoot = KDBRootAppFolder # Capital K 
+1
source

All Articles