How do I debug my Siri (Intents) extension? - ios

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.

Related

Intent does not appear in Supported Intents

Link to all the code I'm working with so far: https://github.com/banool/respose.
I want to make an app where it is possible for users to activate some intent it defines as an action in response to some event in the iOS shortcuts app. For example:
If I open app X.
Run intent from my app instead.
I've seen this done before in other apps, so I know it's possible.
I have an intent defined (see attached code as well as image) that seems to be correct as far as I can tell. I don't think I need an intent extension because I don't intend to handle the intent in the background or via Siri.
I notice that when I try to add an intent under My Target -> General -> Supported Intents, the dropdown doesn't show my intent, only the built in system intents.
I'm not sure what I'm doing wrong here. I got to this point just by following the official guide from Apple: https://developer.apple.com/documentation/sirikit/adding_user_interactivity_with_siri_shortcuts_and_the_shortcuts_app.
I don't think the fact that I'm using Flutter should matter so much right now (I figure that's more of a concern for when the app actually opens up from the shortcut), but perhaps I'm wrong.
I have registered the app on App Store connect and I'm using an identifier that has the sirikit capability enabled. I've also added the "Siri" capability in XCode. I've tried this on both a simulator and a real device, the results are the same.
Any help would be much appreciated, thanks!
Had the same issue.
It seems that you can just type the class name without prompt, and it should work just fine. Don't forget to select proper target though

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

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?

iOS universal links not working?

I'm having trouble getting universal links to work
We have added the json content to our site https://couchsurfing.com/apple-app-site-association
I have double checked that it's using the correct team ID and bundle ID
Universal links is enabled in itunesConnect
running the apple validation fails with the following error:
Error no apps associated with url
I thought maybe the validator doesn't work, but running on iOS 10 device (universal link capability on, with added correct domain to it) clicking a valid link does not trigger the delegate methods in AppDelegate
Any thoughts?
After 3 weeks... It turned out my path was incorrect. My suggestion:
set paths to ["*", "/"] while debugging, get everything to work and test, then as the final step update the path and only include supported paths.
To be more specific the link I was trying to register was
site.com/events/123123 so I would add a path for /events which is wrong that would register site.com/events. I had to register /events/* instead
Also the easiest way to test it is to enter the expected links into the Notes app, because Safari has some weird logic on when links should be handled as deeplink.
Apple's app-site-association validator is useless, it's still failing for me complaining about my App id, when deeplinks actually work. Instead use https://limitless-sierra-4673.herokuapp.com/
I've recently had issues debugging the Universal Link functionality of my app.
I was able to get deep linking to work but it seemed to only work 10% of the time. Since I had just updated to iOS 12, I wanted to make sure there was nothing else I had to do as a developer to ensure the feature worked.
So what was causing intermittent failure?
It seems that iOS has a somewhat strict policy engine for determining when background threads can run.
I was able to observe this by USB tethering to my phone and opening up the debug console for my device
Xcode –> Windows –> Devices & Simulators
Click on device in the left pane
Click Open Console
From there, I was able to filter on "swcd" (SharedWebCredential Daemon). Keeping this console open, I was able to see the daemon at work during app install which is when iOS attempts to pull down the apple-app-site-association file for my app.
As it turns out, dasd (DuetActivitySchedulerDaemon) was failing to run the SharedWebCredential Daemon because my phone had restarted recently, then later it was determined that my phone was too hot...
e.g.
{name: ThunderingHerdPolicy, policyWeight: 1.000, response: {Decision: Must Not Proceed, Score: 0.00, Rationale: [{deviceInUse == 1 AND timeSinceThunderingHerdTriggerEvent < 900}]}}
], FinalDecision: Must Not Proceed}
{name: ThermalPolicy, policyWeight: 5.000, response: {Decision: Absolutely Must Not Proceed, Score: 0.00, Rationale: [{thermalLevel >= 20}]}}
], FinalDecision: Absolutely Must Not Proceed}
Developers beware!
I step through Apple's troubleshooting universal links procedure as already mentioned in other answers.
If still not working, and long-pressing the link in mail or notes app fails to show "Open with [your app]" then try restarting your phone. More than a few times this has been the solution for me!
The Apple validator checks some other things that are not necessary for Universal Links to work, and unfortunately that often results on false positive error messages. The file at https://couchsurfing.com/apple-app-site-association looks good to me, and it passes this validator just fine.
When clicking on a valid link, does the app not open, or just the delegate methods don't fire? These are two very different issues and would have different solutions. There are some troubleshooting steps you could try here, though some of those are specific to the Branch.io (full disclosure: I'm on the Branch team) linking platform.
As some sort of completion to the answers above (took me hours to find out):
The app needs to be installed AFTER you added your "apple-app-site-association" file to the server, as the file initially got fetched / checked after the installation.

How to run Call Directory Extension?

I'm working on Call Directory Extension. This extension was added, however I don't have any idea to execute this. Excuted this extension, and 'Choose an app to run' appeared, selected my main app, but it didn't seem to run. Of course added this app on Settings - Phone - Call Blocking & Identification.
I just added extension, and didn't write any code on both of the main app and extension. Do I need to add some code? Searched for several hours, couldn't find solution. Please help.
Call directory extension is just a new scheme which is about to add with Main application.
You just need to enable your application from settings menu as -
Go to Settings->Phone->Call blocking & identification->Enable your
App.
Hence there is nothing like "Choose with app" like things
Firstly, make sure you have added country code in the numbers you are using in the code.
And then follow these steps :
1) Delete the app from the device.
2) Run the app from Xcode setting the scheme of your main app. This will launch the app on your device.
3) Then change the scheme to your extension’s target and then run again.
Wait for a minute (as extension takes time to load) and then call from the number that you have provided the ID for. The call screen should display the corresponding name.
If the above steps don’t work,
Go to Settings -> General -> Reset -> Reset All Settings. This will clear all the settings on the device. Once this is done, do the above steps again.
This worked for me. If it helps, let me know

Implement deeplinking to bring user to install an iOS app and after install take them into the app

I want to implement deeplinking whereby a user that does not have my app will be brought to the store to install the app, and after install they are taken into a specific part in the app?
The second part is not clear to me - how will user be brought into a specific part of the app after installing and launching it? Does iOS retains the link info?
The simple answer to you question is yes you can do those things but no you cannot do them in the way you want. You would not be able to launch to the app store and then once the app is downloaded launch into a specific place in the app. This is mostly due to security.
So let me explain, there is a method that you can call UIApplication.sharedApplication()canOpenURL(url) which will return a Bool on wither or not you app can open a url. If it comes back as false then you can assume the app does not exist on the device and you can call UIApplication.sharedApplication().openURL(url) where your url = NSURL( https://appsto./Path/to/your/app) then "The User" will have to click the download button.
Then if they try the action again you can callUIApplication.sharedApplication().openURL(url)withurl = (yourapp://).This will launch your application.
Now for launching to a specific place in you app you will need to setup schemes for your app. There is a decent tutorial on doing that here http://www.brianjcoleman.com/tutorial-deep-linking-in-swift/ and also a short synopsis of what you can do found in another answer to deep linking here Confused with IOS Deep linking
So you can get most of the way there but with Sandboxing you will not be able to launch the store, download the app and launch the app all in one move.
Hope this helps, cheers.

Resources