Dev*_*shi 9 objective-c ios oauth-2.0 linkedin-api linkedin-ios-sdk
我正在尝试通过以下链接中提供的步骤在我的应用程序中集成linked-ios-sdk用于用户身份验证:使用Mobile SDK进行身份验证.在提供的示例应用程序中,他们使用此代码:
[LISDKSessionManager createSessionWithAuth:[NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION, LISDK_EMAILADDRESS_PERMISSION, nil]
state:@"some state"
showGoToAppStoreDialog:YES
successBlock:^(NSString *returnState) {
NSLog(@"%s","success called!");
LISDKSession *session = [[LISDKSessionManager sharedInstance] session];
NSLog(@"value=%@ isvalid=%@",[session value],[session isValid] ? @"YES" : @"NO");
NSMutableString *text = [[NSMutableString alloc] initWithString:[session.accessToken description]];
[text appendString:[NSString stringWithFormat:@",state=\"%@\"",returnState]];
NSLog(@"Response label text %@",text);
_responseLabel.text = text;
self.lastError = nil;
// retain cycle here?
[self updateControlsWithResponseLabel:NO];
}
errorBlock:^(NSError *error) {
NSLog(@"%s %@","error called! ", [error description]);
self.lastError = error;
// _responseLabel.text = [error description];
[self updateControlsWithResponseLabel:YES];
}
Run Code Online (Sandbox Code Playgroud)
似乎认证用户的唯一方法是强迫他从app商店下载移动应用程序.如果用户在显示的"下载LinkedIn应用程序"警报视图中选择"否",则程序计数器errorBlock显示以下错误:
错误叫!错误域= LISDKAuthError代码= 3"操作无法完成.(LISDKAuthError错误3)"UserInfo = 0x7f8638488450 {您需要下载LinkedIn应用程序以连接LinkedIn = info}
要处理这种情况,允许从应用程序调用相关的oauth API或使用开源解决方案,例如 - IOSLinkedInAPI,它似乎是这些API的包装器.请建议.
| 归档时间: |
|
| 查看次数: |
873 次 |
| 最近记录: |