【发布时间】:2021-11-26 02:02:54
【问题描述】:
我正在使用共享扩展并且收到以下运行时警告:
注意:即使在新项目上添加共享扩展并运行也会引发相同的运行时警告
[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]"
)}
下面给出的是扩展的 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>
问题:
- 我应该如何解决这个警告?
【问题讨论】:
-
有同样的问题。你找到解决办法了吗?
-
我在一个新项目中添加了共享扩展,并让扩展的 info.plist 和你的一样。但我没有看到任何运行时警告。我的 Xcode 版本是 13.1 和 macOS 11.6,并在 iOS 15.1.1 上运行应用程序。你能提供更多信息吗?
-
运行共享方案,然后打开 safari 并使用您的应用共享链接,此时会显示运行时紫色警告。
-
@alionthego 我得到了 Apple 的官方确认,说这是他们在使用共享功能时出现的错误,我已经提交了错误报告并告诉了他们反馈 ID。希望它有一些时间,现在你可以忽略紫色警告
-
非常感谢您告诉我。
标签: ios ios-extensions