I'm using a test app and extension to attempt a SiriKit exorcism. My extension isn't being called at all and I can't figure out why. I have had a working SiriKit extension in a different app, which has inexplicably stopped responding - hence this test app.
Here's what I've done to set up SiriKit in the test app:
1) Added Siri entitlement to app target:
2) Added Siri usage description to the app's info.plist:
3)Added a new Intents Extension test target, and added my desired Intent to the extension info.plist:
4) Wired up the IntentHandler class:
class IntentHandler: INExtension {
override func handler(for intent: INIntent) -> Any {
print("IntentHandler.handle")
switch intent {
case is INAddTasksIntent: return AddIntentHandler()
default: break
}
return self
}
}
5) Created my handler class:
class AddIntentHandler: NSObject, INAddTasksIntentHandling {
func handle(intent: INAddTasksIntent, completion: @escaping (INAddTasksIntentResponse) -> Void) {
print("AddIntentHandler.handle")
return completion(INAddTasksIntentResponse(code: .success, userActivity: nil))
}
}
6) In AppDelegate get permission to use Siri:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
INPreferences.requestSiriAuthorization({ status in
if status == .authorized {
print("Ok - authorized")
}
})
return true
}
7) Added an AppIntentVocabulary.plist file to the app (I also tested adding it to the extension instead):
8) I double-checked that the extension is embedded in the app target:
9) And that the extension target shows the correct supported intent:
10) Double checked that the app and extension targets require at least iOS version 13.2 in the target deployment info area:
11) I then install the app on an iPhone running iOS 13.3, give Siri permission after it launches, and try to add bacon using Siri. It doesn't call my extension at all, and adds it to the built in reminders app.
12) I launch the extension directly from XCode on the device, same deal - my extension is never called.
I understand it can take a while to register Siri language, but I've been messing with this for days:
Not sure it is related, but like I said I have had Siri working in a different app - not deployed to the app store. I took some time to work on other features in the app and have come back to Siri integration now, only to find out it isn't responding any more. I've rolled back to my last known commit with Siri working only to find it now doesn't work in that (known good) commit either.
Help! I've lost days to this! What is going on or what did I miss?!