这是尝试让两个框架从我的iOS应用程序中的.plist文件加载URL Schemes。目前.plist格式如下:
URL Types (array) >
Item 0 (dictionary) >
URL Schemes (array) >
item 0 (string) - fbfacebookappkey
item 1 (string) - db-dropboxappkey
这首先是正确的吗?
这是我失败的appdelegate代码:
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
//Facebook specific code
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:[PFFacebookUtils session]];
//Dropbox specific code
DBAccount *account = [[DBAccountManager sharedManager] handleOpenURL:url];
if (account)
{
DBFilesystem *filesystem = [[DBFilesystem alloc] initWithAccount:account];
[DBFilesystem setSharedFilesystem:filesystem];
return YES;
}
else
return NO;
}
提前致谢!
答案 0 :(得分:1)
将您的应用委托代码更改为以下内容:
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
//Facebook specific code
if( [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:[PFFacebookUtils session]])
return YES;
//Dropbox specific code
DBAccount *account = [[DBAccountManager sharedManager] handleOpenURL:url];
if (account)
{
DBFilesystem *filesystem = [[DBFilesystem alloc] initWithAccount:account];
[DBFilesystem setSharedFilesystem:filesystem];
return YES;
}
else
return NO;
}
否则只有Facebook网址可以使用。