我們正在與linkedIn客戶C SDK,最新版本共享。LinkedIn Objective C分享
使用此代碼:
NSString *url = @"https://api.linkedin.com/v1/people/~/shares";
NSString *payload = @"{\"visibility\":[{\"code\":\"anyone\"}],\"comment\":\"Check out developer.linkedin.com! http://linkd.in/1FC2PyG\"}";
if ([LISDKSessionManager hasValidSession]) {
[[LISDKAPIHelper sharedInstance] postRequest:url stringBody:payload success:^(LISDKAPIResponse *response) {
// do something with response
NSLog(@"Success: %@", response.description);
dispatch_async(dispatch_get_main_queue(), ^{
_responseLabel.text = response.description;
});
} error:^(LISDKAPIError *apiError) {
// do something with error
NSLog(@"Error: %@", apiError.description);
dispatch_async(dispatch_get_main_queue(), ^{
_responseLabel.text = apiError.description;
});
}];
}
擡離他們的樣品頁漂亮多了。 (不得不更新一下,網站上的URL是用initWithString聲明的,它已經不在了)。
我們已經請求並接收到有效的會話,並根據更新後的規範要求提供w_share許可。
下面是實際的錯誤:
Error Domain=LISDKErrorAPIDomain Code=400 "(null)" UserInfo={LISDKAuthErrorAPIResponse=<LISDKAPIResponse: 0x1288cc100>}
任何提示,將不勝感激!
我會放一個斷點,看看錯誤的userInfo。有一個關鍵(LISDKAuthErrorAPIResponse),可能有一個有趣的對象與更多的信息。 –