Awais Fayyaz
Awais Fayyaz

Reputation: 2415

How to implement sharing suggestions in iOS Swift?

I am trying to follow this apple developer article to implement share suggestions in a sample iOS project.

I have followed these 3 steps exactly as described

  1. Added a share extension in my app.
  2. Declared support for the INSendMessageIntent intent type.
  3. Donated an INSendMessageIntent in app and its share extension.

In the below screenshot, we can see sharing suggestions from Messages app and one other app.

Sharing suggestions highlighted

The problem

Although I have followed all the steps as described in the article, my sample app is not showing as a suggested conversation when i try to share something.

Sample code

You can find the sample project on Github

What am I missing here?

Any help would be much appreciated.

Thanks in advance.

Upvotes: 2

Views: 1423

Answers (1)

M Afham
M Afham

Reputation: 960

1- First you must add your app in suggestions list from the "More" Options. ( Only if you are not seeing your app in apps row in the share sheet )

2- Code Problem: You must provide a not nil image inside intent:

INImage(named: "Image Name") // Won't work if image not exists. 

Problem: enter image description here

Or, Skip Image like this to make it work:

INImage(named: "") // Tested and working 

One Interesting test, When image name doesn't have space, it works even if image doesn't exists:

INImage(named: "ImageName") // Tested and working 

You can see the working example here: Github

Working:

enter image description here

Upvotes: 3

Related Questions