PIXEL
DOCK

I like the smell of Swift in the morning…

How to make your Image Share Extension work in Safari

Posted: | Author: | Filed under: iOS | No Comments »

So you have developed this nice Share Extension to share images. Everything works fine when you select “share” in the Photos App: Your extension is visible and you can use it to share photos from your phone’s photo library.

But then you try to share images from a webpage in Mobile Safari. You press the Share Icon and … your Share Extension does not show up 🙁

What went wrong?

The solution to this problem lies in your Share Extension’s plist file. There you define what types of files your Share Extension can share. Because in your case the Share Extension only accepts image files this should be fine:

NSExtensionActivationRule

    NSExtensionActivationSupportsImageWithMaxCount
    5

This works for the Photos App. But it does not work in Safari. To enable your Share Extension in Safari you have to add one more activation rule:

NSExtensionActivationRule

    NSExtensionActivationSupportsImageWithMaxCount
    5
    NSExtensionActivationSupportsWebURLWithMaxCount
    1

Now you can share images in Safari via your Share Extension 🙂


Leave a Reply