Siri – contact searching behaviour similar to skype for audio call

You can handle that in resolveContactsForStartAudioCall method, check that the person you get in that intent contains in your app contact list.

- (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){
            if([self containContact:recipients.firstObject.displayName]){
               [resolutionResults addObject:[INPersonResolutionResult successWithResolvedPerson:recipients.firstObject]];
            }else [resolutionResults addObject:[INPersonResolutionResult unsupported]];
        }else if(recipients.count>1){
            [resolutionResults addObject:[INPersonResolutionResult disambiguationWithPeopleToDisambiguate:recipients]];
        }else{
            [resolutionResults addObject:[INPersonResolutionResult unsupported]];
        }
        completion(resolutionResults);
}
- (BOOL)containContact:(NSString *)displayName {
           //fetch contacts and check, if exist retun YES else NO
}

Please note you may need to enable App Group support if you want to share contacts from your application to any extension. Here are some guidelines:

  1. Apple Document
  2. Stack Overflow link

Leave a Comment