這可能是微不足道的,但在你的問題中,你實際上並沒有在你的回調塊中做任何事情,你只是傳入一個空白塊。
在成功塊中,檢查[[LISDKSessionManager sharedInstance] session]
以獲取有效的用戶會話。在錯誤塊,檢查錯誤對象的描述,並在必要時提醒用戶:
[LISDKSessionManager
createSessionWithAuth:[NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION, nil]
state:nil
showGoToAppStoreDialog:YES
successBlock:^(NSString *returnState) {
NSLog(@"Success!");
LISDKSession *session = [[LISDKSessionManager sharedInstance] session];
}
errorBlock:^(LISDKAuthError *error) {
NSLog(@"Error: %@", [error localizedDescription]);
}
];
更多的潛在原因,這可能發生:
你的應用程序沒有設置爲App運輸安全正常。設置NSAllowsArbitraryLoads
到真正在你的Info.plist的NSAppTransportSecurity設置或白名單的LinkedIn網址:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>linkedin.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
另外,還要確保你白名單LinkedIn的URL方案:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>linkedin</string>
<string>linkedin-sdk2</string>
<string>linkedin-sdk</string>
</array>
來源
2016-03-18 14:07:09
JAL