Georg
Georg

Reputation: 3920

Create iOS share extension that opens my app

What I want to archive in the end, is the possibility for the user to open every single file in my app.

So I went ahead and added public.data and public.content as Supported Document Types as described here: https://www.cocoanetics.com/2013/01/open-in-all-files/ This works find for most files.

But now I have f.e. an email with an image in it, and my app will not appear in the Share-Sheet thinggy. I already figured out, that creating a ShareExtension would solve the problem of my app not showing up.

But ideally, my app would then also start (like the Create PDF in iBooks Share-Extension works. I need that, cause when the user want's to "open" a file using my app, we should be able to decide what to do with it.

It wouldn't be super bad if that doesn't work, but would be nice...

Upvotes: 3

Views: 1184

Answers (1)

Dannie P
Dannie P

Reputation: 4622

System doesn't technically opens your app when user taps on an icon of a ShareExtension. What ShareExtension is - a small binary that's separate from your container (main) iOS app.

Those apps, that appear in activity controller as share extensions, implement a special UI just for that share extension, instead of being opened when user taps on it.

You can implement a share extension that would store files to your main app documents dir or webserver or whatever.

You start by adding a target for the extension and then implement a view controller either from scratch or by inheriting from SLComposeServiceViewController

You can start at this wwdc video

Upvotes: 1

Related Questions