我希望实现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];
}
答案 0 :(得分:3)
只需或
return [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation] || [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];