简体   繁体   中英

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 fe 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...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM