测试背景: Xcode: Xcode8 beta6 iPhone: iOS10 beta6 Language: object-c
我已经在我的应用程序中使用了startAudioCall sirikit来测试我的应用程序调用。然而,在某些情况下,sirikit会失败:如果此人的名字是本地联系人的名字,当我说"Call firstname myApp“时,siri可以启动myApp成功获取此联系人的名字;但如果此人的名字既是名又是姓,当我说"Call firstname(或call firstname) myApp”时,siri会使用电话呼叫此人(而不是myApp)
对于示例:如果John在我的手机中联系,并且我说"call John myApp",这将启动myApp并成功获取此联系人姓名。但是如果约翰·史密斯在我的电话中联系,我说“呼叫约翰(或约翰·史密斯) myApp”,siri就会用电话呼叫这个人(而不是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);
}这是我关于audiocall的代码。有人能帮上忙吗?非常感谢
发布于 2016-10-17 18:04:28
我已经修复了这个问题,在我将应用程序名称从"ST Wifi have“更改为"testApp”后。
现在,无论我说“使用testApp呼叫John”还是“使用testApp呼叫John Smith",它在sirikit上都运行得很好
我认为Siri很难识别带有空格的长应用程序名称
https://stackoverflow.com/questions/39182936
复制相似问题