iOS Automation could not run because an internal error occurred

I am developing a shortcut for an application that is currently in production. The shortcut essentially involves opening the application and launching a notification so that the AppDelegate initiates a process to scan NFC tags.

To achieve this, I have an AppIntent that overrides the variable openAppWhenRun = true and an AppShortcutsProvider to implement this intent.

The problem arises when a user updates to the latest version of the application and tries to implement this shortcut through an automation. The following error appears: "When 'Reader' is detected" encountered an error: The action 'Scan DMA tags' could not run because an internal error occurred.

This does not always happen, only on some devices. However, if we uninstall and reinstall the application, it works perfectly. But this is not a viable solution since the application uses a database and data loss from frequent uninstallations is not acceptable.

Any solution?

I have tried to replicate the error but have been unable to do so. This issue has occurred on both iOS 16 and iOS 17.

我也遇到的类似的问题,iOS16设备运行快捷方式弹出同样的错误弹窗,经排查,发现只有Xcode15.3或15.4编译运行的会有问题,其他Xcode版本正常,不过我对代码进行了以下修改后就正常了,猜测是系统的bug,希望官方能回复,具体改动如下:

原代码: @available(iOS 16, *) struct ZBShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: ZBSearchIntent(), phrases: [ "打开(.applicationName)搜索页面", "进入(.applicationName)搜索页面", "打开(.applicationName)搜索", "进入(.applicationName)搜索" ], @@ -210,11 +217,12 @@ struct ZBShortcuts: AppShortcutsProvider { "打开(.applicationName)完赛赛程", "查看(.applicationName)赛程", "打开(.applicationName)赛程", ], shortTitle: "完赛赛程", systemImageName: "rectangle.on.rectangle" ) }

static let shortcutTileColor: ShortcutTileColor = .lightBlue }

改动后的代码: struct ZBShortcuts: AppShortcutsProvider { @available(iOS 16.0, *) static var appShortcuts: [AppShortcut] { AppShortcut( intent: ZBSearchIntent(), phrases: [ "打开(.applicationName)搜索页面", "进入(.applicationName)搜索页面", "打开(.applicationName)搜索", "进入(.applicationName)搜索" ], @@ -210,11 +217,12 @@ struct ZBShortcuts: AppShortcutsProvider { "打开(.applicationName)完赛赛程", "查看(.applicationName)赛程", "打开(.applicationName)赛程", ], shortTitle: "完赛赛程", systemImageName: "rectangle.on.rectangle" ) }

@available(iOS 16.0, *) static let shortcutTileColor: ShortcutTileColor = .lightBlue }

就是调整了 ”@available(iOS 16, *)” 的声明位置就正常了

I also encountered a similar problem, the same error popup appeared in the running shortcut of iOS16 devices. After investigation, it was found that only Xcode15.3 or 15.4 had problems when compiled and run, while other Xcode versions were normal, but after I made the following modifications to the code, I guess it was a bug in the system, I hope the official reply can be made. Specific changes are as follows:

Original code: @available(iOS 16, *) struct ZBShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: ZBSearchIntent(), phrases: [ "Open (.applicationName) search page ", "Go to (.applicationName) search page ", "Open (.applicationName) search ", "Enter (.applicationName) search" ]. @@-210,11 +217,12 @@struct ZBShortcuts: AppShortcutsProvider { "Open (.applicationName) finish schedule ", "View (.applicationName) schedule ", "Open (.applicationName) schedule ", ]. shortTitle: "Complete Schedule ", systemImageName: "rectangle.on.rectangle" ) }

static let shortcutTileColor: ShortcutTileColor = .lightBlue }

The modified code: struct ZBShortcuts: AppShortcutsProvider { @available(iOS 16.0, *) static var appShortcuts: [AppShortcut] { AppShortcut( intent: ZBSearchIntent(), phrases: [ "Open (.applicationName) search page ", "Go to (.applicationName) search page ", "Open (.applicationName) search ", "Enter (.applicationName) search" ]. @@-210,11 +217,12 @@struct ZBShortcuts: AppShortcutsProvider { "Open (.applicationName) finish schedule ", "View (.applicationName) schedule ", "Open (.applicationName) schedule ", ]. shortTitle: "Complete Schedule ", systemImageName: "rectangle.on.rectangle" ) }

@available(iOS 16.0, *) static let shortcutTileColor: ShortcutTileColor = .lightBlue }

Just adjust the location of the "@available(iOS 16, *)" statement

iOS Automation could not run because an internal error occurred
 
 
Q