How do I debug my Siri (Intents) extension?
Asked Answered
M

4

15

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?

Morven answered 29/6, 2016 at 8:10 Comment(0)
M
19

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/

Modulus answered 4/7, 2016 at 1:56 Comment(3)
This is probably the right way to start - at least some parts do work now. But still I can not debug - I'm debugging the host app with this setup, not the extension!Morven
You need to Attach to Process by PID or Name. Enter the name of you extension before starting the debug. At least in the days of Xcode 8 beta 4 this used to workMorven
You can also edit your Intent extension's scheme with a Siri Intent Query to avoid having to speak to your phone each time you need to debug something.Moonlight
E
8
  1. Run your app in device first.

  2. Select SIRIKIT extension scheme run in your device, select your app from the list prompted.

  3. Wait for SIRI to be active, send your running SIRIKIT extension into background.(Some times you need not to do this step also).

  4. Activate SIRI by pressing home button again, give a command and you will see your breakpoints working inside Intent Handler.

Engine answered 24/9, 2016 at 21:29 Comment(2)
In step 2, when I select my app from the list instead of Siri, it just starts my app and never starts Siri.Disney
^^^ same thing happens to me, just launches the app - my handler is never run. it's listed in the extension's plist as the handler. my breakpoints never hit and print statements never print.Monolatry
B
0

In my case, Xcode 13.X, iOS15

  1. Change target to you intent extension

  2. Run extension and choose your App

    enter image description here

  3. After App launch, trigger your shortcut(you can use Siri or just tap shortcut)

  4. You will see your breakpoints working inside Intent Handler

enter image description here

Bramblett answered 17/5, 2022 at 3:45 Comment(0)
S
-1

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.

Stopping answered 13/12, 2020 at 23:33 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.