Search code examples
iosios-extensions

NSExtension - Runtime warning - [NSXPCDecoder validateAllowedClass:forKey:]


I am using a share extension and I get the following runtime warning:

Note: Even adding the share extension on a new project and running throws the same runtime warning

[Foundation] *** -[NSXPCDecoder validateAllowedClass:forKey:]: NSSecureCoding allowed classes list contains [NSObject class], which bypasses security by allowing any Objective-C class to be implicitly decoded. Consider reducing the scope of allowed classes during decoding by listing only the classes you expect to decode, or a more specific base class than NSObject. This will become an error in the future. Allowed class list: {(
    "'NSObject' (0x7fff862bc6e8) [/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib]"
)}

Given below is the Extension's info.plist

<?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>
            <dict>
                <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
                <integer>1</integer>
            </dict>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>
</dict>
</plist>

Questions:

  • What should I do to fix this warning?

Solution

  • Conclusion:

    • I got an official confirmation from Apple that it is a bug at their end while using share features
    • I have filed a bug report and have told them about the feedback ID.
    • I was told that I could ignore the error as long as I don't see any issues with my app.

    Note:

    As new OS, Xcode has been released, it would be better to raise a bug and check with Apple DTS to confirm this