简体   繁体   中英

Integration of Dropbox in iPhone application error 400

I am using the great source code called GSDropboxDemoApp which nicely integrate the Dropbox in the application. However, after linked to the app to Dropbox, it gives error in loading folder contents. Below are the codes

I have already edited the 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'

You should be using a constant , like so:

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

Constants are used so that you don't need to worry about the actual value itself.

对于我们这些(未来偶然发现这个问题)使用ruby运动获得相同的错误,它需要是:

dropboxRoot = KDBRootAppFolder # Capital K

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM