Re: [問題] 重複使用問題

作者: FirstFan (Evan)   2014-09-27 21:32:24
我的code給您參考,都是些大陸service的集成,沒有Google+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSString *urlStr = [url absoluteString];
//Sina Weibo
if ([urlStr hasPrefix:@"wb"] && [WeiboSDK handleOpenURL:url delegate:self]) {
return YES;
}
//Wechat
if ([urlStr hasPrefix:@"wx"] && [WXApi handleOpenURL:url delegate:self]) {
return YES;
}
//Tencent QQ
if ([urlStr hasPrefix: @"tencent"]) {
return [TencentOAuth HandleOpenURL: url];
}
if ([urlStr hasPrefix: @"QQ"]) {
return [QQOpenSDK.sharedSDK handleOpenUrl: url];
}
return NO;
}
※ 引述《starkite (可樂果)》之銘言:
: 其實標題不知道該怎麼問....XD
: 因為同時需要fb.google+及微博登入功能
: 但是google+及微博同時用了
: G+
: - (BOOL)application:(UIApplication *)application
: openURL:(NSURL *)url
: sourceApplication:(NSString *)sourceApplication
: annotation:(id)annotation {
: return [GPPURLHandler handleURL:url
: sourceApplication:sourceApplication
: annotation:annotation];
: }
: 微博
: - (BOOL)application:(UIApplication *)application
: openURL:(NSURL *)url
: sourceApplication:(NSString *)sourceApplication
: annotation:(id)annotation {
: return [WeiboSDK handleOpenURL:url delegate:self];
: }
: 請問要如何分開?
: 還是只能這樣做呢?
: - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
: {
: if(1){
: return [WeiboSDK handleOpenURL:url delegate:self];
: }else if (2){
: return [GPPURLHandler handleURL:url
: sourceApplication:sourceApplication
: annotation:annotation];
: }
: }
作者: starkite (可樂果)   2014-09-30 14:25:00
謝謝First大的分享!

Links booklink

Contact Us: admin [ a t ] ucptt.com