我整合了最新的sdks个Linkedin来分享内容。因为它以前工作但现在它给出了错误。请找到以下错误消息。
错误域= LISDKErrorAPIDomain代码= 400“(null)” 的UserInfo = {LISDKAuthErrorAPIResponse =}
请在共享内容的应用程序中找到我正在使用的以下代码。
- (IBAction)postOnLinkedin:(id)sender {
if ([LISDKSessionManager hasValidSession]) {
[self postOnLinedln];
}
else {
[LISDKSessionManager createSessionWithAuth:[NSArray
arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION,
LISDK_EMAILADDRESS_PERMISSION, LISDK_W_SHARE_PERMISSION, nil]
state:@"some state" showGoToAppStoreDialog:YES
successBlock:^(NSString *returnState) {
[self postOnLinedln];
}
errorBlock:^(NSError *error) {
[self showAlert:error.localizedDescription];
}
];
}
}
- (void)postOnLinedln {
NSString *url = @"https://api.linkedin.com/v1/people/~/shares";
NSString *payload = [NSString stringWithFormat:@"{\"comment\":\"Hello\","
"\"content\":{ \"title\":\"Title\","
"\"description\":\"%@\","
"\"submitted-url\":\"\","
"\"submitted-image-url\":\"\"},"
"\"visibility\":{ \"code\":\"anyone\"}}", self.description];
if ([LISDKSessionManager hasValidSession]) {
[[LISDKAPIHelper sharedInstance] postRequest:url stringBody:payload
success:^(LISDKAPIResponse *response) {
// do something with response
dispatch_sync(dispatch_get_main_queue(),^{
[self showAlert:@"Posted successfully"];
});
}
error:^(LISDKAPIError *apiError) {
// do something with error
dispatch_sync(dispatch_get_main_queue(),^{
[self showAlert:apiError.description];
});
}];
}
else {
[self showAlert:@"No Valid session Linkdln"];
}
}
由于我已经通过LinkedIn的开发人员门户解决了这个问题,但没有得到任何帮助。
答案 0 :(得分:0)
答案 1 :(得分:0)
答案 2 :(得分:0)
删除你的有效负载并添加它。
NSString *url = @"https://api.linkedin.com/v1/people/~/shares";
NSString *payload = [NSString stringWithFormat:@"{\"comment\":\"Hello\","
"\"content\":{ \"title\":\"Title\","
"\"description\":\"hi\","
"\"submitted-url\":\"hello\","
"\"submitted-image-url\":\"\"},"
"\"visibility\":{ \"code\":\"anyone\"}}"];