如何在ios中实施谷歌和Facebook网址处理?

时间:2014-09-23 09:32:53

标签: ios objective-c

我希望实现Google以及Facebook登录功能。他们都有一个url处理方法应该在appDelegate.Now如何在这里区分这两个请求。

Facebook方法是这样的。

  - (BOOL)application:(UIApplication *)application
        openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication
     annotation:(id)annotation {

          // Call FBAppCall's handleOpenURL:sourceApplication to handle Facebook app responses
             BOOL wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];

          // You can add your app-specific url handling code here if needed

              return wasHandled;
   }

Google的方法如下:

 - (BOOL)application: (UIApplication *)application
        openURL: (NSURL *)url
   sourceApplication: (NSString *)sourceApplication
     annotation: (id)annotation {
         return [GPPURLHandler handleURL:url
               sourceApplication:sourceApplication
                  annotation:annotation];
 }

1 个答案:

答案 0 :(得分:3)

只需

 return [GPPURLHandler handleURL:url
               sourceApplication:sourceApplication
                  annotation:annotation] || [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];