简体   繁体   中英

IOS Share extension: how to read from notes posts

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM