IOS Share extension: how to read from notes posts

我的未来我决定 提交于 2019-12-19 17:03:08

问题


I want my app to be able to parse text from notes app post as well other text editors posts, so i created an share extension target. Everything worked fine until i prepare the app for publish, replacing the TRUEPREDICATE by NSExtensionActivationRule.

Supposedly, in my share extension target, i should add NSExtensionActivationSupportsText key to NSExtensionActivationRule in info.plist, which i did, but still my app extension doesn't show up in the share sheet.

According to https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html my info.plist should contain this:

<key>NSExtensionAttributes</key>
<dict>
   <key>NSExtensionActivationRule</key>
   <dict> 
        <key>NSExtensionActivationSupportsText</key>
        <integer>1</integer>
   </dict>
</dict>

I try enable also other types like attachments, files, web pages, but had no effect.


回答1:


At least in iOS 9, the correct code is

<dict>
    <key>NSExtensionActivationSupportsText</key>
    <true/>
</dict>

For reference, this is typically what it would like for text share extension support:

<key>NSExtensionAttributes</key>
<dict>
    <key>NSExtensionActivationUsesStrictMatching</key>
    <integer>2</integer>
    <key>NSExtensionActivationRule</key>
    <dict>
        <key>NSExtensionActivationDictionaryVersion</key>
        <integer>2</integer>
        <key>NSExtensionActivationSupportsText</key>
        <true/>
    </dict>
</dict>


来源:https://stackoverflow.com/questions/34548322/ios-share-extension-how-to-read-from-notes-posts

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