简体   繁体   中英

iOS linkedin share not working

I could not make work the new linkedin sdk. It just open the login view. When i logged in then it go to linked in account/profile rather then showing the share prompt. Do anyone have any blog or example with latest sdk ? It just wasted my 3 days. Please help.

NSArray *permissions = [NSArray arrayWithObjects:LISDK_W_SHARE_PERMISSION, nil];

[LISDKSessionManager createSessionWithAuth:permissions state:nil showGoToAppStoreDialog:YES successBlock:^(NSString *returnState)
 {
     NSLog(@"%s","success called!");

     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);
                                                }];
     }


 }
                                errorBlock:^(NSError *error){
                                    NSLog(@"%s","error called!");
                                }];

//

I'm facing the same issue.This is an effective method but not a good idea: UIApplication.sharedApplication().openURL(NSURL(string: "https://www.linkedin.com/shareArticle?mini=true&url=http://developer.linkedin.com&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn")!)
If you successfully share something via the SDK for iOS,please let me know.

Just use a URL like this and hyperlink your share button/icon/text...

https://www.linkedin.com/sharing/share-offsite/?url={url}

Source: Microsoft LinkedIn Share URL Documentation .

For example, this works for me:

https://www.linkedin.com/sharing/share-offsite/?url=http://www.wikipedia.org/

Works fine:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM