From cb2f6c40addac738a2d26901cc44d14be02cbac4 Mon Sep 17 00:00:00 2001 From: Denis Morozov Date: Sat, 26 Aug 2017 15:03:32 +0300 Subject: [PATCH] Handle multiple contacts passed to intent --- SiriIntents/IntentHandler.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SiriIntents/IntentHandler.m b/SiriIntents/IntentHandler.m index 9a5c146d9..48a7d41d5 100644 --- a/SiriIntents/IntentHandler.m +++ b/SiriIntents/IntentHandler.m @@ -65,7 +65,14 @@ // Check if the user has selected appropriate room among several candidates from previous resolution process run if (callee.customIdentifier && callee.customIdentifier.length) { - completion(@[[INPersonResolutionResult successWithResolvedPerson:callee]]); + // If callee will have the same name as one of the contact in the system contacts app + // Siri will pass us this contact in the intent.contacts array and we must provide the same count of + // resolution results as elements count in the intent.contact. + // So we just pass the same result at all iterations + NSMutableArray *resolutionResults = [NSMutableArray array]; + for (NSInteger i = 0; i < contacts.count; ++i) + [resolutionResults addObject:[INPersonResolutionResult successWithResolvedPerson:callee]]; + completion(resolutionResults); return; } else