'从应用程序使用 class <INPreferences: 0x600000cd64a0> 需要授权 com.apple.developer.siri。你启用了 Siri

'Use of the class <INPreferences: 0x600000cd64a0> from an app requires the entitlement com.apple.developer.siri. Did you enable the Siri

我和 swift 5 和 Xcode 12 一起工作。 我启用了 Siri 并在 ViewController

中添加了“import Intents”

在视图中加载:

override func viewDidLoad() {
   super.viewDidLoad()

   INPreferences.requestSiriAuthorization { (status) in }
}

我的应用程序崩溃:

libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Use of the class <INPreferences: 0x600000cd64a0> from an app requires the entitlement com.apple.developer.siri. Did you enable the Siri capability in your Xcode project?'
terminating with uncaught exception of type NSException

有什么想法吗? :/

转到 Signing & Capabilities -> Capability -> Siri(double click) 并等待配置文件更新。

一旦您看到 Siri 如下图所示,然后 运行 您的项目。