[英]Sharing a image URL and text in LinkedIn integration using sdk
In LinkedIn sharing,LinkedIn provide a SDK but using this SDK,I can't share image link and text it always shows 在LinkedIn共享中,LinkedIn提供了一个SDK,但使用此SDK时,我无法共享始终显示的图像链接和文本
LISDKErrorAPIDomain Code=403 The operation couldn't be completed.
LISDKErrorAPIDomain代码= 403无法完成该操作。 (LISDKErrorAPIDomain error 403.)
(LISDKErrorAPIDomain错误403。)
Code: 码:
NSString *url = @"https://api.linkedin.com/v1/people/~/shares";
NSString *payload = @"{\"comment\":\"Check out developer.linkedin.com! http://linkd.in/1FC2PyG\",\"visibility\":{ \"code\":\"anyone\" }}";
if ([LISDKSessionManager hasValidSession])
{
[[LISDKAPIHelper sharedInstance] postRequest:url stringBody:payload
success:^(LISDKAPIResponse *response) {
// do something with response
NSLog(@"response : %@",response.data);
}
error:^(LISDKAPIError *apiError) {
// do something with error
NSLog(@"error: %@",apiError);
}];
}
Sharing on LinkedIn Error : LISDKErrorAPIDomain Code=403 The operation couldn't be completed. 在LinkedIn上共享错误:LISDKErrorAPIDomain Code = 403无法完成该操作。
if you are repeating same static text to post on LinkedIn, it might be a change to getting same error. 如果您重复相同的静态文本以在LinkedIn上发布,则可能是更改为获得相同的错误。
you must get share permission before add post 您必须先获得共享权限,然后才能添加信息
NSArray *permissions = [NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION,LISDK_W_SHARE_PERMISSION, nil];
full login code 完整的登录代码
NSArray *permissions = [NSArray arrayWithObjects:LISDK_BASIC_PROFILE_PERMISSION,LISDK_W_SHARE_PERMISSION, nil];
[LISDKSessionManager createSessionWithAuth:permissions state:nil showGoToAppStoreDialog:YES successBlock:^(NSString *returnState){
NSLog(@"%s","success called!");
LISDKSession *session = [[LISDKSessionManager sharedInstance] session];
NSLog(@"Session : %@", session.description);
[[LISDKAPIHelper sharedInstance] getRequest:@"https://api.linkedin.com/v1/people/~"
success:^(LISDKAPIResponse *response) {
NSData* data = [response.data dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *dictResponse = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
NSString *authUsername = [NSString stringWithFormat: @"%@ %@", [dictResponse valueForKey: @"firstName"], [dictResponse valueForKey: @"lastName"]];
NSLog(@"Authenticated user name : %@", authUsername);
} error:^(LISDKAPIError *apiError) {
NSLog(@"Error : %@", apiError);
}];
} errorBlock:^(NSError *error) {
NSLog(@"Error called : %@", error);
}];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.