[英]Integration of Dropbox in iPhone application error 400
我正在使用名為GSDropboxDemoApp
的優秀源代碼,它很好地將Dropbox集成到應用程序中。 但是,在將應用程序鏈接到Dropbox之后,它在加載文件夾內容時出錯。 以下是代碼
我已經編輯了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;
}
GSDropboxDemoApp[4674:907] [WARNING] DropboxSDK: error making request to /1/metadata/kDBRootAppFolder - (400) Expected a root of either 'dropbox' or 'sandbox', got 'kDBRootAppFolder'
您應該使用常量 ,如下所示:
NSString *dropboxRoot = kDBRootAppFolder; // either kDBRootAppFolder or kDBRootDropbox
使用常量,這樣您就不必擔心實際值本身。
對於我們這些(未來偶然發現這個問題)使用ruby運動獲得相同的錯誤,它需要是:
dropboxRoot = KDBRootAppFolder # Capital K
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.