My app is not showing up in Share Sheet

2.9k Views Asked by At

I integrated share extension in my application. This is my plist file for share extensions.

<key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>NSExtensionActivationRule</key>
            <string>TRUEPREDICATE</string>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>

I am receiving warning in Xcode that if I use Truepredicate then apple will reject my application. So I tried adding other activation rule as mentioned below

<key>NSExtensionAttributes</key>
    <dict>
        <key>NSExtensionActivationSupportsImageWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
        <integer>1</integer>
    </dict>
    <key>NSExtensionMainStoryboard</key>
    <string>MainInterface</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.share-services</string>
    </dict>

But if I remove Truepredicate and add above rules my share extension does not show any more. With truepredicate share extensions works perfectly fine. Can anyone help me what should I do here? I had integrated share extensions for music related apps.

2

There are 2 best solutions below

0
On BEST ANSWER

There was mistake in My Plist file that's why was facing such issue.

Posting this answer just because may be in future if someone will do such mistake so my answer could help out!

<key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>NSExtensionActivationRule</key>
            <dict>
                <key>NSExtensionActivationSupportsText</key>
                <true/>
                <key>NSExtensionActivationSupportsWebURLWithMaxCount</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>

This is working perfectly fine!

1
On

You have to wrap your new keys such as NSExtensionActivationSupportsWebURLWithMaxCount inside a dictionary tag.

Put this back in your code:, NSExtensionActivationRule, this key needs to reference the dictionary of new keys.

I don't write apps for ios, so I'm not sure why <string>TRUEPREDICATE</string> is the default. I just know it allows all data types to be passed implicitly. Data types must be explicitly as shown below.

Example:

<key>NSExtensionActivationRule</key>
    <dict>
        <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationSupportsImageWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationSupportsFileWithMaxCount</key>
        <integer>0</integer>              
        <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
        <integer>0</integer>            
        <key>NSExtensionActivationSupportsText</key>
        <false/>
    </dict>
    <key>NSExtensionPointName</key>
    <string>com.apple.ui-services</string>
    <key>NSExtensionPointVersion</key>
    <string>1.0</string>
    </dict>
    <key>NSExtensionMainStoryboard</key>
    <string>MainInterface</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.ui-services</string>