我希望我的应用程序能够解析笔记应用程序帖子以及其他文本编辑器帖子中的文本,因此我创建了一个共享扩展目标.一切正常,直到我准备应用程序发布,取代TRUEPREDICATE
NSExtensionActivationRule.
NSExtensionActivationRule.
据说,在我的共享扩展目标中,我应该将NSExtensionActivationSupportsText密钥添加到info.plist中的NSExtensionActivationRule,我这样做了,但我的应用扩展程序仍未显示在共享表中.
根据https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html我的info.plist应该包含这个:
<key>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <dict> <key>NSExtensionActivationSupportsText</key> <integer>1</integer> </dict> </dict>
解决方法
至少在iOS 9中,正确的代码是
<dict> <key>NSExtensionActivationSupportsText</key> <true/> </dict>
<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>