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>
Related
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>
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
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>
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>
...
I am trying to create a custom template in Xcode. In my TemplateInfo.plist, for key Options, I have the code pasted below. This template will be for a class that more often than not (but not always) will use delegation when events occur.
The issue I am having is with the value at the very bottom, RequiredOptions. I want the text box to be enabled only if the withProtocol checkbox is checked. However, I can't figure out what value and type of value to use. I have tried the following:
<true/> (as below) - The text box is always enabled.
<string>YES</string> - The text box is always disabled.
<integer>1</integer> - The text box is always enabled.
Does anyone have any ideas for what else I could try? Better yet, does anyone know of a decent reference for Xcode templates?
I have already read through Apple's plist manual pages and the article at this website.
<array>
<dict>
<key>Description</key>
<string>The name of the class to create</string>
<key>Identifier</key>
<string>productName</string>
<key>Name</key>
<string>Class</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Default</key>
<string>false</string>
<key>Identifier</key>
<string>withXIB</string>
<key>Name</key>
<string>With XIB for user interface</string>
<key>Type</key>
<string>checkbox</string>
</dict>
<dict>
<key>Description</key>
<string>Choose whether or not a delegate skeleton is included.</string>
<key>Default</key>
<string>false</string>
<key>Identifier</key>
<string>withProtocol</string>
<key>Name</key>
<string>With delegate skeleton</string>
<key>Type</key>
<string>checkbox</string>
</dict>
<dict>
<key>Description</key>
<string>The name of the protocol used for delegation.</string>
<key>Identifier</key>
<string>protocolName</string>
<key>Name</key>
<string>Protocol</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
<key>RequiredOptions</key>
<dict>
<key>withProtocol</key>
<true/>
</dict>
</dict>
</array>
I fixed my own problem by replacing <true/> with <string>true</string>.
Correct way of adding a required option based on a checkbox
The key of the RequiredOptions dictionary must be the identifier of the other option, and the value of the dictionary must be the array of subset of values from the option that allow the current option to be enabled.
<key>RequiredOptions</key>
<dict>
<key>withXIB</key>
<array>
<string>true</string>
</array>
</dict>
In your case, true gets the job done.
Tested on Xcode 12 ✅