友盟获取授权信息等,方法不走回调,例如
[[UMSocialManager defaultManager] getUserInfoWithPlatform:UMSocialPlatformType_Sina currentViewController:nil completion:^(id result, NSError *error) {
if (error) {
} else {
UMSocialUserInfoResponse *resp = result;
// 授权信息
NSLog(@"Sina uid: %@", resp.uid);
NSLog(@"Sina accessToken: %@", resp.accessToken);
NSLog(@"Sina refreshToken: %@", resp.refreshToken);
NSLog(@"Sina expiration: %@", resp.expiration);
// 用户信息
NSLog(@"Sina name: %@", resp.name);
NSLog(@"Sina iconurl: %@", resp.iconurl);
// NSLog(@"Sina gender: %@", resp.unionGender);
// 第三方平台SDK源数据 , 以上信息都可在 源数据中找到
NSLog(@"Sina originalResponse: %@", resp.originalResponse);
sucBlock([NSString stringWithFormat:@"http://weibo.com/%@",resp.originalResponse[@"profile_url"]], resp.name);
}
}];
解决:// 重写AppDelegate的handleOpenURL和openURL方法:
#pragma mark - 设置系统回调
// 支持所有iOS系统
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSLog(@"111111");
return [self openLiveOpenURL:url];
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
NSLog(@"111111");
return [self openLiveOpenURL:url];
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options NS_AVAILABLE_IOS(9_0){
NSLog(@"111111");
return [self openLiveOpenURL:url];
}
- (BOOL)openLiveOpenURL:(NSURL *)url {
if (!url) return NO;
NSString *urlString = [url absoluteString];
if ([urlString hasPrefix:@"wx"]) {
return [WXApi handleOpenURL:url delegate:self];
}else if ([urlString hasPrefix:@"wb"]) {
[[UMSocialManager defaultManager] handleOpenURL:url];
}
//判断是否是通过LinkedME的UrlScheme唤起App
else if ([urlString rangeOfString:@"click_id"].location != NSNotFound)
{
return [[LinkedME getInstance] handleDeepLink:url];
}
return YES;
}