How do I export text from iOS Notes app to my app?

a 夏天 提交于 2019-12-02 09:18:43

I used one of my allotted support requests to ask Apple, and after some time and back and forth I was able to get my answer! Here is what they said:

Your project is missing a Share app extension. Start by reviewing the App Extension Programming Guide: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/index.html#//apple_ref/doc/uid/TP40014214-CH20-SW1

Information specific to the Share extension point: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Share.html#//apple_ref/doc/uid/TP40014214-CH12-SW1

You don’t need to register the text content type in your CFBundleDocumentTypes. as you’ve done in your sample. However, you will need to provide an activation rule for the extension point, such as the one shown in this section of the document (the section titled Declaring Supported Data Types for a Share or Action Extension): https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW1

See specifically the predicate example that activates the extension if an attachment with the com.adobe.pdf UTI is present. You will need to do something similar, to cover the UTIs for content you would like your share extension to consume. As a starting point, you can consume text with the public.text UTI. For more common UTIs, please see this document: https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1

I also found the bits about providing an activation rule to be super confusing, and this answer helped that: How do I set NSExtensionActivationRule predicates?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!