【发布时间】:2017-01-27 18:36:19
【问题描述】:
我们正在努力与linkedIn 目标C SDK 共享最新版本。
使用此代码:
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>}
任何提示将不胜感激!
【问题讨论】:
-
我会设置一个断点并查看错误的用户信息。那里有一个键 (LISDKAuthErrorAPIResponse),它可能有一个有趣的对象,其中包含更多信息。
标签: objective-c linkedin sharing