テストの背景: のXcode:Xcode8のbeta6 iPhone:iOS10 beta6 言語:オブジェクト-CシリキットStartAudioCall失敗
私は私のアプリの呼び出しをテストするために私のアプリでstartAudioCallのシリキットを使用していました。しかし、シルキットはいくつかの状況で失敗するでしょう: 人の名前がローカルの連絡先の名字である場合、私は "コールファーストネームmyApp"と言うと、siriはmyAppを開始することができますこの連絡先の名前を正常に取得 しかし、 (私の電話ではなく)電話を使ってこの人に電話します。
例: 私の電話の連絡先にJohnがいれば、名前と姓は「私の名前と姓のmyAppを呼んでください」と言うとき、私は "John myAppに電話する"と言います。これはmyAppを起動し、この連絡先の名前を正常に取得します。 しかし、ジョン・自分の携帯電話の連絡先でのスミス、と私が言う「ジョン(またはジョン・スミス)を呼び出して、myApp」は、シリはこの人(ない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。 誰でも手伝いできますか? Thx a lot
「John myAppに電話する」と言うと、siriがアプリの代わりに電話を使用すると、resolveContactsForStartAudioCallメソッドが呼び出されますか? – rocky
いいえ、それは解決するために来ません.ContactsForStartAudioこの関数を呼び出すので、私はこのケースをどのように制御するか分かりません。 – Vaycent