我使用这个链接:
[[DBSession sharedSession] linkFromController:self];
从 xcode 构建时工作正常,并且似乎在应用商店和临时构建上工作正常,如果已安装则显示 Dropbox 应用程序,如果未安装则显示另一个视图
[DBSession sharedSession] isLinked]
从 xcode 构建时返回 true,但在使用 ad hoc 或应用商店构建时返回 false。有人对可能导致这种情况的原因有任何想法吗?
好的,我想我有它。它现在在我的临时构建中工作。我们将看看它获得批准后会发生什么。似乎新版本的 API 要求您在应用打开时处理 url,如下所示:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
if ([[DBSession sharedSession] handleOpenURL:url]) {
if ([[DBSession sharedSession] isLinked]) {
// At this point you can start making API Calls. Login was successful
[self doSomething];
} else {
// Login was canceled/failed.
}
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
我仍然不知道为什么在测试中我的设备上的所有东西都可以正常工作,但不适用于 ad hoc 或应用商店构建,但似乎处理 openURL 回调解决了这个问题。