App Intents don't show on device, while they do in the simulator

Hello.

I want to provide my users with some useful shortcuts and chose AppIntents to do so. I watched the relevant WWDC talks, read the documentation and I set up a few simple intents, adhering to AppIntent. I also created a AppShortcutsProvider to offer the most useful of my intents on installation. I did use \(.applicationName) within my phrases.

Trying it out on the simulator, it works as intended (Ventura 13.3, Xcode 14.3, iOS 16.4). Wonderful! Now, building the same code for my hardware device (iPhone SE 3rd Gen, iOS 16.4) and trying it out on there, nothing shows up - neither the intents I want to add on install, nor the ones the user would have to select manually. I really have no idea why...

On a side note: My app does have a Watch counterpart and I'd like to do the same there, but with intents specific to the Watch app. They don't even show up in the simulator, though.

Any ideas what could've went wrong here? I'd appreciate it.

Thanks!

Answered by x_szagun in 750590022

I figured it out. Just wish I had looked into the build log in the first place... I guess it didn't have much to do the with Watch target, just the code I copy pasted. Anyways, it seems appintentsmetadataprocessor failed because of a custom type I had created.

2023-04-12 17:07:44.429 appintentsmetadataprocessor[74428:4172175] warning: At least one halting error produced during export. No AppIntents metadata have been exported and this target is not usable with AppIntents until errors are resolved.
2023-04-12 17:07:44.429 appintentsmetadataprocessor[74428:4172175] warning: 'typeDisplayRepresentation' must directly instantiate a 'TypeDisplayRepresentation'

This works:

static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Prüfung")

This doesn't:

static var typeDisplayRepresentation : TypeDisplayRepresentation = .init(name: "Prüfung")

Yeah

I tried again yesterday and it wouldn't even turn up in the simulator anymore.

Later I managed to check out a much earlier version, implement a simple test intent there and have it show up in the Shortcuts app (slightly earlier commits had the same problem). Going back to my current working state and pasting the same test intent there, it suddenly worked as expected again. Now I tried figuring out, what made the behavior occur in the first place and replicated my steps from the first time around:

It happens right after trying to add AppIntents on the WatchOS target. They won't show up there and those on the iOS side will stick around for a while, even if all AppIntents code is completely removed. New intents added on the iOS side won't show up at all. A while later the zombified intents disappear as well, leaving the state I described in my initial post (intents I saw on the simulator there, were from before I had tried adding some on WatchOS). All subsequent builds have this problem. I tried deleting DerivedData, Caches, switching around Xcode versions. Nothing works. Now even going to my early commit and back again does nothing. Guess I'll just have to wait?

Somebody, please help :(

Does you physical device have Shortcuts app installed?

I noticed that if you remove the Shortcuts app that it seems like the App Intent doesn't get registered.

Accepted Answer

I figured it out. Just wish I had looked into the build log in the first place... I guess it didn't have much to do the with Watch target, just the code I copy pasted. Anyways, it seems appintentsmetadataprocessor failed because of a custom type I had created.

2023-04-12 17:07:44.429 appintentsmetadataprocessor[74428:4172175] warning: At least one halting error produced during export. No AppIntents metadata have been exported and this target is not usable with AppIntents until errors are resolved.
2023-04-12 17:07:44.429 appintentsmetadataprocessor[74428:4172175] warning: 'typeDisplayRepresentation' must directly instantiate a 'TypeDisplayRepresentation'

This works:

static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Prüfung")

This doesn't:

static var typeDisplayRepresentation : TypeDisplayRepresentation = .init(name: "Prüfung")

Yeah

App Intents don't show on device, while they do in the simulator
 
 
Q