iOS - SiriKit Intent Extension - Cannot see prints nor hit breakpoints - ios

I'm trying to incorporate SiriKit intents into my application. I followed all the instructions including
Enable SiriKit
Add the usage string in Info.plist
Add the intent extension target to the project
Add the intent I want to support in the Info.plist of that new target
Add my handler method for the intent
Add the SiriKit authentication request in the AppDelegate
When I open Siri now and I ask the required question for the intent it does ask me if I want to open my app, so I go ahead and click yes and my app is opened. However, no print-statement in my intent handling method nor a breakpoint in there is hit.
I also tried starting the intent extension scheme via the run button in Xcode, I select my app on the popped up drop down, but then nothing on the phone appears and it just says Finished running my app on the device, no print statement or breakpoints hit either.
Does anybody know what I'm doing wrong here?

Related

Recommend shortcut in Siri after creating Siri shortcut - React Native

I have successfully implemented shortcut in React Native project via react-native-siri-shortcut npm.
I am able to see all those shortcuts in Shortcut app(in iOS).
When I open Siri and speak them, Siri just opens my app.
I have added SiriShortcutListener in my app, and just displayed alert.
I don't know how to make Siri recommend some stuff or perform the action as I want it to.
Do I have to make any UI for that? Also, how activityType should be used?
Any proper link or tutorial/help will be appreciated.
I'm not sure how the Siri shortcut will work on react-native but as a part of iOS native app development, you have to add SiriKit Intent Definition File to your project.
Once you add that file to your project you will have to add New Intent and have to configure it the way you would like to utilize it in your app.
I hope it will give some hint on your further research or developing.

Are voice shortcuts for custom SiriKit Intents supported on watchOS?

I’m trying to get a voice shortcut for a custom Siri Intent working as part of an Apple Watch app, but I’m not sure whether that’s possible. Has anyone had success with this or know if it’s supported?
There isn't much code to share in this case, since most of the code is auto-generated by Xcode, but here’s a quick overview of how I have everything set up.
I created a custom Intent with a .intentdefiniton file and separate Intents Extension targets for my iOS app and watchOS app to handle the Intent.
I set up and donate the shortcuts at the appropriate time. I included an INUIAddVoiceShortcutButton in my app so a user can easily add or edit a phrase for the shortcut.
Everything works fine on an iPhone: the shortcut shows up at relevant times throughout iOS, and the Intents Extension in my iOS app handles the shortcut when I say the invocation phrase to Siri.
Since 20% of my app’s users use the Apple Watch app, I want to provide a congruent experience on watchOS. The donated shortcut shows up on the Siri watch face, as expected. I trigger the shortcut from the Siri watch face, and is handled by the Intents Extension that's part of my watchOS app.
When I say the intent’s invocation phrase to my Apple Watch (Series 3 GPS-only), however, it doesn’t work. Siri says:
Checking with the app...
Then a few seconds later:
I do not recognize that command.
I’ve tried this with a separate Intents Extension for my watchOS app, and without. I get the same results in both situations. It works on the simulator, but not on a real device.
I’ve also made sure I have my Watch Extension and Watch App selected under Target Membership for the .intentdefinition file.
I’ve also tried going into Settings > Developer and enabling Display Recent Shortcuts then tapping Force Sync Shortcuts to Watch, but that doesn’t change the behavior.
Are voice shortcuts for these custom intents even supported on Apple Watch? I haven’t been able to tell one way or another with Apple’s documentation. The SoupChef sample project is set up with an Intents Extension for the watchOS app, which makes me think it should be supported. And, since it works on the simulator, that makes me think it should be supported.
However, this page doesn’t list custom intents as being supported on watchOS, so that makes me think they may not be supported: https://developer.apple.com/design/human-interface-guidelines/watchos/user-interaction/siri/
If anyone can help me figure out whether this is supported I’d really appreciate it. I’m not sure if I’m doing something wrong or if this just isn’t supported.
The problem was on my Apple Watch.
I was able to get it working by erasing the watch (Settings > General > Reset > Erase All Content and Settings) then restoring it from a backup.

SiriKit - INSendPaymentIntentHandling - Sharing custom classes in IntentHandler which were written in the app breaks functionality

I'm trying to integrate Siri to my app with INSendPaymentIntentHandling. I've made all necessary changes required (info.plist, certificates, extensions, etc).
Everything works in perfect sync, and a Siri dialog appears to confirm payment when I say - "Send money using xxxxxx".
But when I use one of classes written for my app (ContactsManager), Siri goes like - "You need to continue in the app" with no dialogue which was shown earlier, and message on console appears as - "Program ended with exit code: 0"
I already did the necessary steps to share a class between targets by checking Siri target from right pane in Xcode.
Kindly suggest mistakes.

Sirikit launching the app fully instead of showing in own scroll

I have just created single view controller app and adding targets with Siri extensions( intents and intent ui extension).
But when I say Siri command to start the intent it just launching the app instead of showing in Siri view itself. Since I have started exploring Siri please let me know the issue and if any tutorial I can go through
I had the same problem. The bug was that the extension's plist contained the wrong entry in NSExtensions->NSExtensionAttributes->IntentsSupported – obviously the default Xcode actions are incorrect.
What you need to state there are the actual class names of the intents you handle, not their names as per the intentdefinition file.
Disabling 'copy only when installing' under Embed App Extensions in main target build phases fix the issue for me.
You should follow these steps:-
Add intents and intentsUI(if you need to customize default UI) as
extension
Override the Intent handers
Mention your intents in info.plist
Allow app to be accible by siri in phone settings
The best way to start is to go thru the SiriKit Programming Guide
Also, you can get some sample code from Apple here

How do I debug my Siri (Intents) extension?

I'm building a Siri aka Intents extension.
I do understand that I can attach the debugger to a running process after start, however, I never see my process. I do have the authorization for my app set to active and the extension must be running at least for some time, Siri is showing clear responses.
By the Apple documentation, you should run the Extension Scheme with Siri as host app. However, if I try that nothing happens on the device, it's waiting to attach for ever. Apple mentions the first connection can take "several minutes", but not hours ...
Any idea where I'm going wrong or how to achieve a connection to the debugger? Or at least some console output?
just select your siri extension scheme and hit run button, then xcode will prompt a list of applications for you to choose, just choose your app, for more details, please checkout the article:http://jamesonquave.com/blog/adding-siri-to-ios-10-apps-in-swift-tutorial/
Run your app in device first.
Select SIRIKIT extension scheme run in your device, select your app from the list prompted.
Wait for SIRI to be active, send your running SIRIKIT extension into background.(Some times you need not to do this step also).
Activate SIRI by pressing home button again, give a command and you will see your breakpoints working inside Intent Handler.
In my case, Xcode 13.X, iOS15
Change target to you intent extension
Run extension and choose your App
After App launch, trigger your shortcut(you can use Siri or just tap shortcut)
You will see your breakpoints working inside Intent Handler
I tried all the ways and it didn't work I think it's because I have a mac too old (2010) and has no ability to process.
This is a very hack solution to debug but it works.
Create a webhook using this site https://webhook.site
Then if you want to check if you code was in some point just add this code:
(Don't forget to change the URL for the same that you received webhook)
let url1 = URL(string: "https://webhook.site/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/your_code_was_here")!
let task1 = URLSession.shared.dataTask(with: url1)
task1.resume()
Then you just need to look again at the webhook site to see if the GET request got there.

Resources