gpt4 book ai didi

iOS : LinkedIn Sign In is not redirecting to webpage when app is not installed

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:47:29 24 4
gpt4 key购买 nike

我正在尝试将 linkedin 集成到我的 ios 应用程序中。我观察到,如果未安装该应用程序,我的应用程序会显示安装 linkedin 应用程序,而不是像 facebook 和 gmail 那样重定向到网络浏览器。我想知道天气 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!");
}
];

最佳答案

如果您的设备上未安装该应用程序,它将调用错误 block ,您必须向用户显示一条警告,告知您必须从应用程序商店下载应用程序。用户可以单击“否”,然后它将与 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];
}
}
];

}

关于iOS : LinkedIn Sign In is not redirecting to webpage when app is not installed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37177570/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com