-26
我正在實施一個VoIP應用程序,我需要通過Siri發起呼叫。我能夠通過Siri發起呼叫。但問題是 - 每次應用程序啓動時,雖然聯繫人不在應用程序的聯繫人列表中。Siri - 聯繫人搜索行爲類似於Skype的音頻呼叫
我不知道如何以及在哪裏處理。我的意思是如果應用程序沒有像Skype那樣的聯繫人處理它,則不會啓動該應用程序。 Skype回覆如下:
嗯,Skype沒有找到<用戶>。
您想給誰打電話?
貝婁是我的擴展處理程序的代碼片段:
- (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);
}
討論[上元(http://meta.stackoverflow.com/questions/340839/user-answers-a-question-of -another用戶和 - 詢問最相同問題-再次-已經?CB = 1)。我認爲我們可以停止downvoting。 –
@ThomasWeller感謝您的回覆。我試圖在meta討論中說清楚。錯誤是我的,我爲此道歉。但仍然下調。 – makboney