Hiding Your Action and Share Extensions In Your Own Apps
In PDF Viewer, we use a
UIActivityViewController
to share PDFs. This means that our Action extension shows up in the list of actions as well! So a user would see an "Import to PDF Viewer" button inside PDF Viewer. There isn't an easily available API to prevent this from happening. However, the extension'sInfo.plist
does haveNSExtensionActivationRule
insideNSExtensionAttributes
.[…]
The important bit is
AND NOT (ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "your.unique.uti.here")
. This ensures that if theUIActivityViewController
is created with any items matchingyour.unique.uti.here
, your extension will not be displayed in the list of options. […] Next we need to add an item with a UTI matchingyour.unique.uti.here
to the items passed into theUIActivityViewController
.