1

I am trying to share something via the branch.io share sheet:

let shareText = "Some Share Text"

let linkProperties = BranchLinkProperties()
linkProperties.feature = "Some"
linkProperties.addControlParam("$desktop_url", withValue: desktopURLString)
linkProperties.addControlParam("$android_url", withValue: androidURLString)

let object = BranchUniversalObject(canonicalIdentifier: "some.cannonical.identifier")
object.title = "Some Title"
object.imageUrl = someImageURL
object.contentDescription = "Some Content Description"
object.addMetadataKey("some_id", value: identifier)

object.showShareSheet(with: linkProperties, 
              andShareText: shareText,
                      from: self, 
                completion: completion)

All works great, except that the Facebook Messenger app does not show as option in the share sheet. Neither in the suggested options nor under 'More'. What is needed to achieve that?

I found the following question / answer for the default UIActivityViewController. How does that work with branch.io though? Facebook Messenger not showing up with UIActivityViewController

Community
  • 1
  • 1
helkarli
  • 131
  • 1
  • 8
  • why you are not using UIActivityViewController ? and also Facebook and Facebook messenger does not allow you to send text. It is the policy of Facebook that no one can send pre text in the share sheet .... Just send the image in the activity and Messenger will automatically appeared – Naveed Khan Feb 10 '17 at 09:48
  • the facebook app appears however. i want facebook messenger to appear too, respectively know what is causing it not to appear. i need the additional support that branch is offering for sharing / tracking. – helkarli Feb 10 '17 at 10:28

2 Answers2

2

When you share via a share sheet on iOS - whether you use the Branch share sheet or UIActivityViewController - the choice of sharing options is not yours to define, it is defined by the user.

The interface for setting which apps will appear on the list can be accessed by opening a Share Sheet and then scrolling through the list of presented apps until you see the "..." (More) option. Tap on this button and you will be presented with the list of apps that can be shared to on the phone:

enter image description here

Each app will have a slider - if the slider is enabled for a particular app, that app will appear in the list.

enter image description here

Enabling Facebook Messenger for sharing on a user's phone is not something you can do from within your app as a developer.

You mention that the Messenger app is not even available when you tap the More button. This strikes me as odd; every device I check does have Facebook Messenger as an option if it is installed. Perhaps try removing and reinstalling Facebook Messenger.

dwestgate
  • 1,044
  • 6
  • 12
  • thank you @dwestgate. the above stated i knew. i am using branch. so i think this is actually a branch issue. – helkarli Feb 28 '17 at 08:17
  • I'm sorry, but I don't understand. You indicate that you have some kind of issue, but then you describe expected behavior - – dwestgate Feb 28 '17 at 13:27
  • Also, to be clear: Branch uses the same Apple functions that you would call yourself to display the share sheet, so whether you use Branch or not, the behavior is the same. – dwestgate Feb 28 '17 at 13:35
  • Sure, but depending on what you pass as values to the share sheets certain apps appear. When I open the default share sheet messenger appears, when I open the branch share sheet messenger doesn't appear (not even in the more section as you stated). The stackoverflow link I posted in my question says that messenger needs an URL. Maybe this is not happening in branch? Or something else goes wrong? I can't be sure since I have no access to the branch code... – helkarli Mar 01 '17 at 11:32
  • The Branch SDK is open source, so you do have access to the code, here: https://github.com/BranchMetrics/ios-branch-deep-linking/blob/8f295d3491c4b4c2b94c81da5c07ff40e32bccf8/Branch-SDK/Branch-SDK/BranchUniversalObject.m#L163. I have never seen any difference between Branch's share sheet and the Apple share sheet as you are describing, but woukd be very interested in seeing this. Can you provide steps so that I could follow to reproduce what you are seeing? – dwestgate Mar 01 '17 at 13:48
0

I dived into the issue once more and I finally found the trouble maker. If I set feature of the branch link properties to a string value containing a space, Messenger disappears in the share sheet. The example:

    let properties = BranchLinkProperties()
    properties.feature = "Share News"   //does not work, messenger does not appear in the share sheet
    //properties.feature = "Share_News" //works, messenger appears in share sheet
    object.showShareSheet(with: properties, andShareText: "Some Share Text", from: viewController, anchor: UIBarButtonItem()) { (activityType, completed) in
        if (completed) {
            print(String(format: "Branch TestBed: Completed sharing to %@", activityType!))
        } else {
            print("Branch TestBed: Link Sharing Cancelled\n")
        }
    }

feature is used as a parameter in the URL in Branch which is then given to the sharing extension. While this, I think, is an encoding issue in Branch, it seems that the Messenger sharing extension is not handling the URL in the same way as other apps. The 'broken url' does work with other sharing extensions. Hope this helps someone else! I will change the name of my feature to something without space for now.

helkarli
  • 131
  • 1
  • 8