AppIntents runtime error

When debugging the Smart Stack widget and running my Apple Watch project in Xcode 10.4 I started to see AppIntents.PerformIntentError.intentNotFound error. I’ve found that there’s at least one person with a solution on Apple Developer forum.

Quick fix

The forum solution requires changing the iPhone app target configuration.

Xcode iPhone target preferences

This change generates an AppName-Info.plist file with the following content.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>INIntentsRestrictedWhileLocked</key>
	<array>
		<string>ConfigurationAppIntent</string>
	</array>
	<key>INIntentsSupported</key>
	<array>
		<string>ConfigurationAppIntent</string>
	</array>
</dict>
</plist>

I also needed to check the intent Swift file under the iPhone app target, otherwise, it won’t build or crash during launch (I don’t remember exactly).

Swift file checked out under main iPhone target

Better solution

Before trying to fix the problem, I asked myself a question, why this custom configuration was in the project in the first place, and is it needed? I know that these preferences can affect the iOS widget and have no effect in the Smart Stack behaviour. The way watchOS works is when a watch is locked, the Smart Stack is not available. It’s not possible to interact with the Smart Stack when the Apple Watch is locked. The preference I had under both targets can and should be removed. Since the preference was the only entry on the plist file. I could delete the entire file. Supported Intents sections are empty in every target. In conclusion, I have one less Info.plist file in the project and fewer configurations associated with the project.

Real application

This post is dedicated to my Apple Watch password manager — Pero, soon to be renamed to Pinbook.