iOS Sharing Image to LinkedIn using UIActivityViewController

微笑、不失礼 提交于 2019-12-06 04:11:46

问题


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



来源:https://stackoverflow.com/questions/30079344/ios-sharing-image-to-linkedin-using-uiactivityviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!