Alexander Leontev
Alexander Leontev

Reputation: 477

iOS 8 Share Extension for specific file format

Let's say I have a .gif file. When I select it and click Share, I want to see my app in App Extension sheet, but ONLY if it has ".gif" filename extension. How can I achieve that?

Upvotes: 1

Views: 807

Answers (1)

Peter Johnson
Peter Johnson

Reputation: 3786

See Apple docs at App Extension Programming about NSExtensionActivationRule.

Basically you need to supply a predicate string for it that excludes any files that don't comply. (This will be easy if there is a UTType for .gif, as there is for .PNG (kUTTypePNG), but I'm not sure that there is)

Second thing to try would be to reject on filename (if that is possible) else you'll have to accept all kUTTypeImage and reject in the extension itself.

I don't think accepting all shares that comply with kUTTypeImage but rejecting any that comply with kUTTypeJPEG and kUTTypePNG would work as a solution, as apps might provide images in several formats, including .gif.

Upvotes: 1

Related Questions