{"id":16658,"date":"2016-12-19T09:46:15","date_gmt":"2016-12-19T14:46:15","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=16658"},"modified":"2016-12-19T09:46:15","modified_gmt":"2016-12-19T14:46:15","slug":"hiding-your-action-and-share-extensions-in-your-own-apps","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/12\/19\/hiding-your-action-and-share-extensions-in-your-own-apps\/","title":{"rendered":"Hiding Your Action and Share Extensions In Your Own Apps"},"content":{"rendered":"<p><a href=\"https:\/\/pspdfkit.com\/blog\/2016\/hiding-action-share-extensions-in-your-own-apps\/\">Aditya Krishnadevan<\/a>:<\/p>\n<blockquote cite=\"https:\/\/pspdfkit.com\/blog\/2016\/hiding-action-share-extensions-in-your-own-apps\/\">\n<p>In PDF Viewer, we use a <code>UIActivityViewController<\/code> 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 <em>inside<\/em> PDF Viewer. There isn't an easily available API to prevent this from happening. However, the extension's <code>Info.plist<\/code> does have <code>NSExtensionActivationRule<\/code> inside <code>NSExtensionAttributes<\/code>.<\/p>\n<p>[&#8230;]<\/p>\n<p>The important bit is <code>AND NOT (ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO \"your.unique.uti.here\")<\/code>. This ensures that if the <code>UIActivityViewController<\/code> is created with any items matching <code>your.unique.uti.here<\/code>, your extension will not be displayed in the list of options. [&#8230;] Next we need to add an item with a UTI matching <code>your.unique.uti.here<\/code> to the items passed into the <code>UIActivityViewController<\/code>.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Aditya Krishnadevan: 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's [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[905,31,1380,30,1381,71],"class_list":["post-16658","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-extensions","tag-ios","tag-ios-10","tag-mac","tag-macos-10-12","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=16658"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16658\/revisions"}],"predecessor-version":[{"id":16659,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16658\/revisions\/16659"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=16658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=16658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=16658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}