如何将多个框架调用集成到openURL:(NSURL *)url

时间:2014-07-15 07:08:26

标签: ios objective-c parse-platform facebook-ios-sdk dropbox-api

这是尝试让两个框架从我的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;
    }

提前致谢!

1 个答案:

答案 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网址可以使用。