iOS Sharing Image to LinkedIn using UIActivityView

2020-07-17 07:34发布

问题:

I'm trying to share image to all possible apps installed in my device. But unfortunately, I'm not able to post image successfully to LinkedIn (already installed and logged in as verified user).

LinkedIn is being displayed in list of share actions in UIActivityViewController, when I tap on it, It displays a dialogue with image, which I have added as activity item, but it is not being posted to LinkedIn.

Tested successfully for Google+, FB and Twitter.

If I share url, then it gets posted to LinkedIn app. Only image is not being posted.

I got these lines in Console Log:

2015-05-06 19:27:54.369 Share[1659:309834] LaunchServices: invalidationHandler called 2015-05-06 19:27:59.824 Share[1659:309793] plugin com.linkedin.LinkedIn.ShareExtension invalidated

Here is the code i'm trying:

- (IBAction)openShare:(id)sender{
UIImage *img1 = [UIImage imageNamed:@"Test1.jpg"];
NSString *str = @"iOS";
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];

UIActivityViewController *activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:@[img1,url,str]
                                  applicationActivities:nil];

[self presentViewController:activityViewController
                                   animated:YES
                                 completion:^{
                                     NSLog(@"completed");
                                 }];

}

回答1:

I'm having the same problem. Anytime i try to share a photo, even when is only a photo i get an error and the share is not performed correctly.

As a solution i'm not sharing the photo when the activityType is com.linkedin.LinkedIn.ShareExtension