Reputation: 31
Although I believe I am following the right instructions for the handle function of the intent handler; everything finishes as it should (the data is saved), I send the success code back from the handle function and yet when the request is finished, Siri always displays "Continue in app". Anyone had a similar problem and know the solution? Here is the code I implement before exiting the handler, written in swift:
let userActivity = NSUserActivity(activityType: NSStringFromClass(INAddTasksIntent.self))
let response = INAddTasksIntentResponse(code: .success, userActivity: userActivity)
completion(response)
Upvotes: 2
Views: 925
Reputation: 31
For those concerned, the problem is solved by attaching the target task list and the tasks to be added to the response as follows:
let responseCode = INAddTasksIntentResponseCode.success
let response = INAddTasksIntentResponse(code: responseCode,
userActivity: nil)
var addedTasks:[INTask] = []
for title in intent.taskTitles!{
let newTask = INTask(title: title, status: .notCompleted, taskType: .completable, spatialEventTrigger: nil, temporalEventTrigger: nil, createdDateComponents: nil, modifiedDateComponents: nil, identifier: nil)
addedTasks.append(newTask)
}
response.modifiedTaskList = intent.targetTaskList!
response.addedTasks = addedTasks
completion(response)
Upvotes: 1