Perform final validation of the intent parameters and verify that your services are ready to fulfill the intent.
After you resolve the parameters of an intent, but before you handle that intent, SiriKit may ask you to confirm the intent details. The confirmation phase is your chance to perform any final validation of the intent parameters and to verify that any needed services are available. For example, you might confirm that you can communicate with your company’s server. After performing your final validation, you provide SiriKit with a response object indicating how you plan to handle the request.
Listing 1 shows a confirmation method used by a running app to validate an
INStart object. Because the app uses Core Location to map the user’s run, the method verifies that the needed location services are available and returns a failure code if they are not. Otherwise, the response object contains the
INStart code, which indicates that the app is ready to start the run.
Providing a custom
NSUser object with your response during confirmation is recommended but not required. If SiriKit needs to launch your app for any reason, it passes the provided activity object to your app. Your app can use any information in the object to take further actions. For example, you might include custom data in the user activity object that your app can then use to configure its interface.