3

I'd like to share a link + text to Linkedin with a UIActivityViewController but my code don't works :( I see Facebook and Twitter but not Linkedin

    let url: NSURL =  NSURL(string: "http://www.google.com")!
    let text: String = "Test Linkedin"

    let items: [AnyObject] = [url, text]

    let activityViewController: UIActivityViewController = UIActivityViewController(activityItems: items, applicationActivities: nil)
    activityViewController.setValue("Test", forKey: "subject")
    self.presentViewController(activityViewController, animated: true, completion: nil)

If I set only the url I see Linkedin in my options. Where is the problem? I see that Safari Sharing works well.

1 Answers1

0

Apple does not provide an activity for LinkedIn. If you want to share text and a link with the UIActivityViewController, you need to create your own UIActivity. See the documentation here :

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIActivity_Class/index.html

You can also look at this SO post that will show you how to create your custom one (in Objective-C)

How can I create a custom UIActivity in iOS?

Community
  • 1
  • 1
Laurent Rivard
  • 509
  • 4
  • 13