swiftsiri

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


I working with swift 5 and Xcode 12. I enabled Siri and add "import Intents" in my ViewController

in the viewdidload:

override func viewDidLoad() {
   super.viewDidLoad()

   INPreferences.requestSiriAuthorization { (status) in }
}

My app crashs:

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

Any idea? :/


Solution

  • Go to Signing & Capabilities -> Capability -> Siri(double click) and wait for the provisioning profile to update.

    Once you see the Siri as shown in the below image then run your project.

    enter image description here