Not able to get Apple Watch Ultra Action Button Support working

I've tried building and running https://github.com/KhaosT/WatchActionButtonExample which works just fine.

In my own project however even with the StartWorkoutIntent implemented as per https://developer.apple.com/documentation/appintents/actionbuttonarticle the option for my app in the action button settings never appears, in the simulator or on a test device.

I've made sure WKBackgroundModes includes workout-processing and have fully implemented a StartWorkoutIntent (both a real implementation and also tried it with a dummy implementation from the KhaosT/WatchActionButtonExample repo). Despite all this I still can't get my app to appear in the action button settings screen.

Is there anything I can do to further debug this? Has anyone else run into a similar issue? I've just spent the entire day trying to make this work...

Did you ever figure this out? We were able to get our app to show up for the action button and then it just disappeared from the action button list a few weeks ago. We can't find anything that has changed and we are also able to get https://github.com/KhaosT/WatchActionButtonExample to work just fine.

Did you ever figure this out? I am seeing the same thing and I can't figure out what I am doing wrong.

I have found a little more information on this, but I have not yet been able to pinpoint it. I thought I would share where I am at in case it helps someone else find this issue. I found that if I build the app with Xcode 14.0 and remove CryptoSwift as a package dependency most of the time I can get it to work. I say most of the time because sometimes when I do a clean build on a new simulator it still does not work. But about 80% of the time it is working for me when I do this. I then tried Xcode 14.1 with CryptoSwift removed from my project and I got it to work once, but I was never able to get it to work again when I would do a fresh build.

With each of these tests I was using a watchOS 9.0 simulator. I then tried building with Xcode 14.0 without CryptoSwift as a dependency and I was able to select my app for the action button on my Apple Watch Ultra running watchOS 9.3.

This does seem to point to a bug in Xcode 14.2 with the build settings and dependences. I am going to keep experimenting to see if I can pinpoint exactly what the combination is that makes it work.

I am able to get https://github.com/KhaosT/WatchActionButtonExample to work just fine with Xcode 14.2.

If anyone else is seeing this and has information on this issue, I would greatly appreciate any insights you might have.

I found exactly what I have to do with my app to get the action button to work.

  1. I have to use Xcode 14.0.1
  2. I had to remove CryptoSwift as a package dependency and add it as an xcframework instead. What is odd is that I am linking against the exact same version of CryptoSwift, I just had to change how I brought it into my project.

I found that the reason I did not have constant results was that I needed to delete the DerivedData every time I switch versions of Xcode.

I could not get the action button to work with my app using Xcode 14.1 or Xcode 14.2. Most likely there is something else, like removing the CryptoSwift packager dependency that I need to do to get it to work. I tried removing the other swift package dependencies that I have and that did not make any difference.

I've figured the issue on my end so thought I'd share as well in case it helps everyone out. In my case I was trying to define the caseDisplayRepresentations for one of my App Enums dynamically using

static var caseDisplayRepresentations: [WorkoutType : DisplayRepresentation] = Dictionary<WorkoutType, DisplayRepresentation>(uniqueKeysWithValues: allCases.map { ($0, DisplayRepresentation(stringLiteral: $0.localizedName)) })

This doesn't seem to be supported by the appintentsmetadataprocessor. I figured this out while reading the full build logs for a different reason and stumbled upon the following lines:

2023-02-11 09:29:43.852 appintentsmetadataprocessor[73327:5009856] Starting appintentsmetadataprocessor export

2023-02-11 09:29:44.041 appintentsmetadataprocessor[73327:5009856] error: 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-02-11 09:29:44.041 appintentsmetadataprocessor[73327:5009856] error: invalid 'caseDisplayRepresentations' for TimerNinja.WorkoutType, representations must be exhaustive and include all cases for this enum.

2023-02-11 09:29:44.042 appintentsmetadataprocessor[73327:5009856] error: cannot extract 'caseDisplayRepresentations' for TimerNinja.WorkoutType, is not a compile-time constant value
Not able to get Apple Watch Ultra Action Button Support working
 
 
Q