Test Background: Xcode: Xcode8 beta6 iPhone: iOS10 beta6 Language: object-c
I have used startAudioCall sirikit in my App to test my app call. However, the sirikit will fail in some situation: If the person's name is a first name in local contact, when I say "Call firstname myApp", siri can start myApp get this contact name successfully But if the person's name is both first name and last name, when I say "Call firstname(or both first name and last name) myApp" , siri will call this person using phone call(not myApp)
For exsample: if John in my phone contact, and I say "call John myApp", this will start myApp and get this contact name successfully. But if John Smith in my phone contact, and I say "call John(or John Smith) myApp" , siri will use phone call to call this person(not myApp)
- (void)resolveContactsForStartAudioCall:(INStartAudioCallIntent *)intent
withCompletion:(void (^)(NSArray<INPersonResolutionResult *> *resolutionResults))completion{
NSLog(@"maytest resolveContactsForStartAudioCall");
NSArray<INPerson *> *recipients = intent.contacts;
NSMutableArray<INPersonResolutionResult *> *resolutionResults = [NSMutableArray array];
if (recipients.count == 0) {
completion(@[[INPersonResolutionResult needsValue]]);
return;
}else if(recipients.count==1){
[resolutionResults addObject:[INPersonResolutionResult successWithResolvedPerson:recipients.firstObject]];
}else if(recipients.count>1){
[resolutionResults addObject:[INPersonResolutionResult disambiguationWithPeopleToDisambiguate:recipients]];
}else{
[resolutionResults addObject:[INPersonResolutionResult unsupported]];
}
completion(resolutionResults);
}
- (void)confirmStartAudioCall:(INStartAudioCallIntent *)intent
completion:(void (^)(INStartAudioCallIntentResponse *response))completion{
NSUserActivity *userActivity = [[NSUserActivity alloc] initWithActivityType:NSStringFromClass([INStartAudioCallIntent class])];
INStartAudioCallIntentResponse *response = [[INStartAudioCallIntentResponse alloc] initWithCode:INStartAudioCallIntentResponseCodeReady userActivity:userActivity];
completion(response);
}
- (void)handleStartAudioCall:(INStartAudioCallIntent *)intent
completion:(void (^)(INStartAudioCallIntentResponse *response))completion{
NSUserActivity *userActivity = [[NSUserActivity alloc] initWithActivityType:NSStringFromClass([INStartAudioCallIntent class])];
INStartAudioCallIntentResponse *response = [[INStartAudioCallIntentResponse alloc] initWithCode:INStartAudioCallIntentResponseCodeContinueInApp userActivity:userActivity];
completion(response);
}
And Here is my code about audiocall. Anyone can help ? Thx a lot
I have fixed this issue, after I changed the App name from "ST Wifi Calling" to "testApp".
Now, no matter I say "Use testApp to call John" or "Use testApp to call John Smith", it's going well on sirikit
I think it's too hard for Siri to recognize a long App name with space