0

I am working on a Siri extension and I am wondering if it is possible to change Siri's response based on the situation.

For example, if the application is supported while iPhone is charging and if the user asks for some actions from Siri while it is not charging, I want Siri to answer "'App Name' requires iPhone to be charging in order to handle the action."

- (id)handlerForIntent:(INIntent *)intent {
    if(charging){
        //Phone is charging; pass corresponding handler
        ...
    }else{
        //Phone is not charging; tell user to charge phone
        return nil;
    }
}

At this point, if I return nil in the handleForIntent, Siri just showsSiri error message in simulator

Basically I want to change the "Sorry, there was a problem with the app." with my own error message.

Some answer suggested to use AVSpeechSynthesizer to convey my error message but it has a couple of issues.

  1. AVSpeechSynthesizer overlaps with Siri response.
  2. Cannot change the displayed message on the Siri screen.

If anyone knows how to modify Siri's response (both text and speech), please provide me with some advice.

Keale
  • 3,924
  • 3
  • 29
  • 46
Bubu
  • 651
  • 8
  • 25
  • You can define your own custom response class with success, failure and other results messages. https://medium.com/@pietropizzi/a-beginners-guide-to-developing-custom-intent-siri-shortcuts-for-ios-12-a3627b7011af – ondermerol Oct 25 '18 at 14:13
  • OMG thanks I will look into it. For some reason, I was not able to find it. Very very appreciated – Bubu Oct 25 '18 at 17:06
  • It looks like custom intent can be only used for shortcut – Bubu Oct 26 '18 at 14:46

1 Answers1

0

Returning nil is a problem, a class instance is required. Also you should handle the test for charging in the confirm intent method.

vilmoskörte
  • 291
  • 1
  • 10