Я реализую приложение VoIP, где мне нужно инициировать вызов через Siri. Я смог инициировать звонок через Сири. Но проблема в том, что каждый раз, когда приложение запускается, хотя контакт отсутствует в списке контактов приложения.Siri - контактное поведение, похожее на skype для аудиовызова
Я не уверен, как и где обращаться с этим. Я имею в виду не запускать приложение, если у приложения нет такого контакта, как Skype. Skype ответил что-то вроде:
Хмм, Skype не нашёл < пользователь>.
Кому вы хотели бы позвонить?
пыльник мой фрагмент кода для обработчика Extension:
- (id)handlerForIntent:(INIntent *)intent {
// This is the default implementation. If you want different objects to handle different intents,
// you can override this and return the handler you want for that particular intent.
return self;
}
#pragma mark - INStartAudioCallIntentHandling
- (void)resolveContactsForStartAudioCall:(INStartAudioCallIntent *)intent
withCompletion:(void (^)(NSArray<INPersonResolutionResult *> *resolutionResults))completion{
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);
}
Обсуждаемые [на Meta] (http://meta.stackoverflow.com/questions/340839/user-answers-a-question-of пользователь свой-чужой-и-просит-The-же-вопрос-опять-уже? центибар = 1). Я думаю, мы можем остановить downvoting. –
@ThomasWeller благодарит вас за ответ. я попытался дать понять на мета-дискуссии. ошибка была моей, и я извинился за это. но все еще вниз. – makboney