首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sirikit StartAudioCall失败

Sirikit StartAudioCall失败
EN

Stack Overflow用户
提问于 2016-08-27 23:47:40
回答 1查看 757关注 0票数 1

测试背景: 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)

代码语言:javascript
复制
- (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的代码。有人能帮上忙吗?非常感谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-17 18:04:28

我已经修复了这个问题,在我将应用程序名称从"ST Wifi have“更改为"testApp”后。

现在,无论我说“使用testApp呼叫John”还是“使用testApp呼叫John Smith",它在sirikit上都运行得很好

我认为Siri很难识别带有空格的长应用程序名称

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39182936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档