0

I have added extension to app(as per apple documentation) but intent handler class is not responding with my commands. what i am missing don't no.Please help me ,How can i add siri to my app.

 // reslove
- (void)resolveContactsForStartAudioCall:(INStartAudioCallIntent *)intent
                          withCompletion:(void (^)(NSArray<INPersonResolutionResult *> *resolutionResults))completion{
    NSArray *contacts;
    NSArray * contacts1;
    INPersonResolutionResult* result = nil;
    if (contacts == intent.contacts) {
        for (INPerson *contact in contacts) {

       contacts1 = [self contactsMatchingName:contact.displayName];
            switch (contacts1.count) {
                case 1:
                    result = [contacts objectAtIndex:0];
                    [INPersonResolutionResult successWithResolvedPerson:[contacts1 objectAtIndex:0]];
                    break;
                case 0:
                    result = [INPersonResolutionResult unsupported];
                    break;
                default:
                    result  = [ INPersonResolutionResult disambiguationWithPeopleToDisambiguate:contacts1];
                    break;
            }
        }
        completion(contacts1);
    }else{
        result =  [INPersonResolutionResult needsValue];
    }


}

// confirmation method
- (void)confirmStartAudioCall:(INStartAudioCallIntent *)intent
                   completion:(void (^)(INStartAudioCallIntentResponse *response))completion{

    INStartAudioCallIntentResponse *result = nil;
    if (![[NSUserDefaults standardUserDefaults]objectForKey:@"isSignedIn"]) {
        result = [[INStartAudioCallIntentResponse alloc]initWithCode:INStartAudioCallIntentResponseCodeReady userActivity:nil];
        completion(result);
    }else{
        NSUserActivity  *activity = [[NSUserActivity alloc]initWithActivityType:@"reLogin"];
        result = [[INStartAudioCallIntentResponse  alloc]initWithCode:INStartAudioCallIntentResponseCodeFailure userActivity:activity];
        completion(result);
    }
}
  • Please provide some code – Asdrubal Jul 11 '16 at 14:22
  • 1
    [Apple's Speakerbox](https://developer.apple.com/library/content/samplecode/Speakerbox/Introduction/Intro.html) implements Siri but unfortunately it's in Swift. Add the CoreLocation.framework to the app and activate it in Settings | Siri, and test it using a phone number as it doesn't recognise Contacts. – Ri_ Nov 22 '16 at 13:20

1 Answers1

1

Here are a few resources to get you started.

  1. Guides and Documentation

SiriKit Programming Guide

Intents Framework

IntentsUI Framework

  1. Sample Code

UnicornChat Sample App

  1. Videos (from WWDC 2016)

Introducing SiriKit

Extending your app with SiriKit

Asdrubal
  • 2,421
  • 4
  • 29
  • 37
  • @asdrubai Thank you giving tutorials i read this documentation before only – Nagendar Reddy Jul 11 '16 at 14:40
  • I am new to iOS development. I added all extensions to project but intend handler is not calling when i use siri – Nagendar Reddy Jul 11 '16 at 14:45
  • @NagendarReddy Perhaps you can visit http://stackoverflow.com/help/asking to better ask your question and make it easier for people to help you. General questions are harder to answer – Asdrubal Jul 11 '16 at 14:48
  • thank you for suggestion . i added code above please see what i have to do – Nagendar Reddy Jul 11 '16 at 15:01
  • He said he read the documentation, as have I, and it doesn't give VoIP examples. It doesn't explain how to put it all together. Your answer isn't helpful at all. I wish StackOverflow would get rid of condescending answers like this. –  Nov 17 '16 at 14:44
  • @BillK It wasn't my intention to be condescending at all. When OP asked the question and when I answered and commented on OP's questions, the question didn't include their code which is why I posted my answer/comments as I did. You can look at the edits to verify. – Asdrubal Nov 17 '16 at 14:57