I have code that shares a url (with a description) to other apps. This code works just fine for Facebook, Instagram, Twitter, etc EXCEPT it does not work for Facebook Messenger. In Facebook messenger, it is as if the url does not exist. It loads up the text, but not the URL.
Here is the code that I am using:
let activityViewController = UIActivityViewController(activityItems: [shareText, UserService.sharedInstance.sharingLink(profile)], applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
let sourceRect = CGRect(x: 0, y: 0, width: self.view.frame.width, height: 1)
activityViewController.popoverPresentationController?.sourceRect = sourceRect
self.present(activityViewController, animated: true, completion: nil)
This block of code has been in my app for awhile, and it was only recently noticed that it did not work with Facebook Messenger.
Does FBM needs some kind of custom handling in order for it to work correctly? If so, where can I see an example / documentation for this? Why does my code correctly work for every app EXCEPT FBM?
Facebook Messenger only handles the string parameter of UIActivityViewController
from the two parameters you've given. You should include the URL in the shared text, like this:
let shareText = "Check out this app! http://example.com"