[英]IOS : LinkedIn Sign In is not redirecting to webpage when app is not installed
我試圖在我的ios應用程序中集成linkedin。我觀察到如果沒有安裝應用程序我的應用程序顯示安裝linkedin應用程序而不是重定向到像facebook和gmail這樣的web瀏覽器。我想知道weather linkedin支持這種事情,如果沒有安裝應用程序重定向到網頁,或者我必須為此編寫自定義代碼。如果是這樣,請幫助我在未安裝linkedin應用程序時以及安裝時編寫自定義代碼。 在我的應用程序中集成linkedin sdk后,我編寫了如下代碼。
LISDKSessionManager createSessionWithAuth:[NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION, LISDK_EMAILADDRESS_PERMISSION, nil]
state:nil
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);
}
errorBlock:^(NSError *error) {
NSLog(@"%s","error called!");
}
];
如果您的設備上未安裝該應用,則會調用錯誤阻止,您必須向用戶顯示您必須從應用商店下載應用的提醒。 用戶可以單擊“否”,然后使用OAuth登錄。
-(void)loginViaLinkedIn
{
__weak __typeof(self)weakSelf = self;
[LISDKSessionManager createSessionWithAuth:[NSArray
arrayWithObjects:LISDK_BASIC_PROFILE_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");
[weakSelf getLinkedInDetail];
}
errorBlock:^(NSError *error) {
NSDictionary * userInfoDic = [error userInfo];
NSString * info = [[userInfoDic allKeys] firstObject];
if([info isEqualToString:@"You need to download the LinkedIn App in order to connect with LinkedIn"] && error.code == 3)
{
[weakSelf loginViaOAuthProtocol];
// Linkedin native app not available , login with OAuth
}
else
{
[weakSelf linkedinAuthenticationResponse:nil error:error];
}
}
];
}
您可以閱讀有關它的官方文檔。 “了解移動身份驗證用戶體驗”根據以下情況,可能會出現幾種可能導致不同用戶體驗的情況:
-Is the LinkedIn application installed on the device?
-Is the user a LinkedIn member?
-Is the user signed into the LinkedIn application on their device?
-Has the user granted your application permission to access their profile?
所有這些都在以下內容中解釋: https : //developer.linkedin.com/docs/ios-sdk-auth#ux
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.