How to handle NSExtensionActivationRule is truepredicate? - ios

I got warning:
Embedded binary's NSExtensionActivationRule is TRUEPREDICATE. Before you submit your containing app to the App Store, be sure to replace all uses of TRUEPREDICATE with specific predicate statements or NSExtensionActivationRule keys. If any extensions in your containing app include TRUEPREDICATE, the app will be rejected
what can I do? I try to modify NSExtension, but I really don't figure out how to solve it.

You have to specify every data type you want to use in Info.plist of your App Extension.
See the documentation for the available keys. Look for NSExtensionActivationRule.
//UPDATE:
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>

I wanted my app to accept text only. This is what works:
...
<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>
...

Related

Action extension not available when sharing a PDF from Safari

Our apps Action Extension needs to support all types of attachments.
It works almost everywhere, the only case I can't get to work is when I try to share a PDF file opened in Safari. For example this one:
https://carlosicaza.com/swiftbooks/SwiftLanguage.pdf
The app is not even appearing on the Share Sheet in Safari, I think there must be something missing in the NSExtensionActivationRule in the info.plist of the Action Extension target.
This is what the NSExtensionActivationRule looks like at the moment. I tried several things but no luck so far.
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsAttachmentsWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
<integer>10</integer>
<key>NSExtensionActivationSupportsText</key>
<true/>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>ShareSheet</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>

My share extension does not show up among the dropbox extensions

I have the following in my extension's plist
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsFileURLWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>
So my extension shows up in Photos and Snapchat, but not Dropbox.
What should I tweak to get listed in dropbox share choices?
And the documentation for the missing key is/was here:
https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AppExtensionKeys.html#//apple_ref/doc/uid/TP40014212-SW11

Invalid info plist value while uploading build contains share extension

My app contain image share extension while uploading build got error somthing like invalid info plist but validating it does not show any error or message.
code :
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>5</integer>
<key>NSExtensionActivationSupportsText</key>
<true/>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
Make sure you change it NOT in the .plist file but in the Extention's info page (Between Resorce Tags and Build Settings)

Share extension app store upload issue

Hello fellow developers,
I'm uploading an app with share extension, extension should only accept images.
For some reason when I'm uploading app for beta testing i get an warning as below.
No values under NSExtensionActivationRule in bundle APPNAME.app/PlugIns/ShareOnAPPNAME.appex appear to trigger activation.
Also I got email saying below
Dear developer,
We have discovered one or more issues with your recent delivery for "APPNAME". Your delivery was successful, but you may wish to correct the following issues in your next delivery:
Unreachable Activation - No values under NSExtensionActivationRule in bundle APPNAME.app/PlugIns/ShareOnAPPNAME.appex appear to trigger activation.
After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.
My plist file in extension target looks like this...I tried adding all support key with value 0 except image and only image key with value 1...but warning persists...
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key> NSExtensionActivationSupportsImageWithMaxCount </key>
<integer>1</integer>
<key>NSExtensionActivationSupportsText</key>
<false/>
</dict>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
<key>NSExtensionPrincipalClass</key>
<string>ShareOnAPPNAMEVC</string>
</dict>
Also App shows sharing option to each and every type i.e. movies, text, webpage etc. along with images.
Ok so I got it working, issue was copy pasted rule NSExtensionActivationSupportsImageWithMaxCount from developer side caused blank spaces in plist :( check below.
<key> NSExtensionActivationSupportsImageWithMaxCount </key>
I would suggest you to use this:
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationRule</key>
<string>TRUEPREDICATE</string>
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
<integer>1</integer>
<key>NSExtensionActivationSupportsText</key>
<false/>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>

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>

Resources