carsten-klaffke / send-intent

Repository for send-intent Capacitor plugin
MIT License
106 stars 12 forks source link

Invalid Info.plist value for NSExtensionActivationRule #86

Closed bash88 closed 10 months ago

bash88 commented 10 months ago

I successfully integrated your awesome plugin into my app. Sharing files and images from other apps to my app works on both Android and iOS. Great! So far. Now I'm trying to distribute my updated iOS app to the Apple App store through Xcode. This process comes back with the following error:

Invalid Info.plist value. The value for the key 'NSExtensionActivationRule' in bundle App.app/PlugIns/Send intent extension.appex is invalid. Please refer to the App Extension Programming Guide on https://developer.apple.com

I've tried many different values for NSExtensionActivationRule but have finally returned to the default value from the readme:

<dict>
    <key>NSExtensionActivationSupportsFileWithMaxCount</key>
    <integer>5</integer>
    <key>NSExtensionActivationSupportsImageWithMaxCount</key>
    <integer>5</integer>
    <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
    <integer>5</integer>
    <key>NSExtensionActivationSupportsText</key>
    <true/>
    <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
    <integer>1</integer>
    <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
    <integer>1</integer>
    <key>NSExtensionActivationUsesStrictMatching</key>
    <false/>
</dict>

All values I tried come back with this same error. Which leads me to think it's not really about the value of NSExtensionActivationRule.

After searching through some SO threads I've checked the following things:

@carsten-klaffke I'm kind of at the end of my rope here. Do you maybe have any suggestions?

carsten-klaffke commented 10 months ago

Hey! So you get this error building your App for "Any iOS Device (arm64)"? But for simulator devices it compiles? Which deployment target do you have configured? And which XCode version do you use? Maybe try clearing the cache and restarting XCode... and please send me your full info.plist file!

bash88 commented 10 months ago

@carsten-klaffke Thanks for your swift reply!

So you get this error building your App for "Any iOS Device (arm64)"? But for simulator devices it compiles?

Builds compile and sharing works both on iOS device and simulator. I Get the error when I try to distribute the archive, built with the "Any iOS Device (arm64)" selected, to the App Store through Xcode. This essentially uploads the app to App Store Connect where it gets analyzed. In that process, the App Store Connect SPI analysis returns an "Asset validation failed" error with the description I mentioned above.

Which deployment target do you have configured?

The iOS Deployment Target selected for both the app and extension targets in the "General" tab is 16.0. I tried different versions here as well.

And which XCode version do you use?

15.0.1

Maybe try clearing the cache and restarting XCode...

Cleaning the build folder and restarting Xcode you mean? Tried this many times. Now once more just to be sure, same error.

and please send me your full info.plist file!

I figured you meant the extension info.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <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>
    <key>NSExtensionActivationRule</key>
    <dict>
        <key>NSExtensionActivationSupportsFileWithMaxCount</key>
        <integer>5</integer>
        <key>NSExtensionActivationSupportsImageWithMaxCount</key>
        <integer>5</integer>
        <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
        <integer>5</integer>
        <key>NSExtensionActivationSupportsText</key>
        <true/>
        <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationUsesStrictMatching</key>
        <false/>
    </dict>
</dict>
</plist>
carsten-klaffke commented 10 months ago

I think your info.plist looks strange. You define NSExtensionActivationRule twice. That first part with "TRUEPREDICATE" seems wrong. Mine looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>IntentsSupported</key>
            <array/>
            <key>NSExtensionActivationRule</key>
            <dict>
                <key>NSExtensionActivationSupportsFileWithMaxCount</key>
                <integer>1</integer>
                <key>NSExtensionActivationSupportsImageWithMaxCount</key>
                <integer>1</integer>
                <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
                <integer>1</integer>
                <key>NSExtensionActivationSupportsText</key>
                <true/>
                <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
                <integer>1</integer>
                <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
                <integer>1</integer>
                <key>NSExtensionActivationUsesStrictMatching</key>
                <false/>
            </dict>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>
</dict>
</plist>

I think you have to replace <string>TRUEPREDICATE</string> with your rule dict.

bash88 commented 10 months ago

@carsten-klaffke No idea how I missed the double NSExtensionActivationRule. It works now that I've copied your info.plist structure. Thank you so much for the pointer and your work on this great plugin!