10

我正在尝试按照以下链接中提供的步骤在我的应用程序中集成linked-ios-sdk 以进行用户身份验证:Authenticating with the 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];
                                                 }

似乎验证用户身份的唯一方法是强迫他从应用商店下载移动应用程序。如果用户在显示的“下载 LinkedIn 应用程序”警报视图程序计数器上选择“否”,则errorBlock显示以下错误:

错误调用!Error Domain=LISDKAuthError Code=3 "The operation could not be completed. (LISDKAuthError error 3.)" UserInfo=0x7f8638488450 {您需要下载LinkedIn App才能连接LinkedIn=info}

要处理这种情况,是否允许从应用程序调用相关的 oauth API 或使用开源解决方案,例如 - IOSLinkedInAPI,它看起来像是这些 API 的包装器。请建议。

4

0 回答 0