Test-Hintergrund: Xcode: Xcode8 beta6 iPhone: iOS10 beta6 Sprache: Objekt-cSirikit StartAudioCall Ausfallen
I startAudioCall sirikit in meiner App verwendet haben meine app Aufruf zu testen. Das sirikit wird jedoch in einer bestimmten Situation fehlschlagen: Wenn der Name der Person ein Vorname in lokalem Kontakt ist, wenn ich sage "Ruf Vorname myApp", kann Siri MyApp beginnen, diesen Kontaktnamen erfolgreich zu bekommen Aber wenn der Name der Person beide zuerst ist Name und Nachname, wenn ich sage "Ruf Vorname (oder Vor- und Nachname) myApp", ruft Siri diese Person mit Anruf an (nicht myApp)
Zum Beispiel: wenn John in meinem Telefon Kontakt, und ich sage "call John myApp", dies wird myApp starten und diesen Kontaktnamen erfolgreich erhalten. Aber wenn John Smith in meinem Telefonkontakt, und ich sage "nennen, John (oder John Smith) myApp", siri Telefonanruf verwenden, diese Person zu nennen (nicht 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);
}
Und hier ist mein Code über Audiokall. Jeder kann helfen? Thx viel
Also, wenn Sie sagen, "John myApp anrufen" und Siri Telefon statt Ihrer App verwendet, wird Ihre resolveContactsForStartAudioCall-Methode aufgerufen? – rocky
Nein, es wird nicht zur Lösung kommenContactsForStartAudioCall diese Funktion, also habe ich keine Ahnung, wie Sie diesen Fall steuern können. – Vaycent