Post

Replies

Boosts

Views

Activity

Reply to Basic app intent always showing error in Shortcuts app "The action could not run because an internal error occurred."
[quote='824169022, DTS Engineer, /thread/770421?answerId=824169022#824169022'] There's a lot of inter-process communication that happens with system features that are hidden away from what you need to worry about at the API level. [/quote] Of course that's very pleasant for us in the end and how it should be. It's just unexpectedly easy for someone used to various XPC mechanisms and distributed notifications to communicate between processes.
Topic: App & System Services SubTopic: General Tags:
Feb ’25
Reply to Basic app intent always showing error in Shortcuts app "The action could not run because an internal error occurred."
Thanks for the explanations. I thought App Intents needed to always be a separate target as they would be executed in a separate process, but for an App Intent that needs the app to run it makes sense that it's declared inside the app. Although I'm still wondering how the Shortcuts app displays the App Intent UI. I guess it's somehow extracted at build time so that it can be loaded and displayed even when the app is not running? That's somewhat counterintuitive to me: the relevant code is in the main target, but available outside the app (in the Shortcuts app).
Topic: App & System Services SubTopic: General Tags:
Feb ’25
Reply to Creating file bookmarks doesn't work anymore on macOS 15 Sequoia
Another macOS 14.7.2 user contacted me with this issue. Angry that my app isn't "compatible with macOS". I told them to contact Apple support, but they just wouldn't listen. Anyway not sure if that would have helped, as Apple support usually tells people that they should contact the third party developer. Then, with two conflicting answers, the user believes that I refuse to help them. Does nobody at Apple see how frustrating this is for us developers? Is there nothing you can do to mitigate the anger our users have towards us because of issues in your operating system? People apparently are more inclined to believe that the small third party developer is at fault. I even sent them a link to this topic to convince them that it's a known macOS issue, but not sure if they visited it or could even understand it. Would it be too much to ask for Apple to make public announcements about these issues that normal users can understand and that we can point them to when they direct their anger towards us?
Topic: App & System Services SubTopic: Core OS Tags:
Feb ’25
Reply to Basic app intent always showing error in Shortcuts app "The action could not run because an internal error occurred."
Thank you for your help. By moving the code into my main target and removing the App Intents Extension I was able to make it work. It feels strange though. Since when is it sufficient to add a declaration in code which is then automatically available outside of the app? Is the app intent's perform() code still running within the app? When I was using the App Intents Extension I used to encode the intent's arguments and send them via a distributed notification which was then observed by the main app. But now apparently I can directly pass the arguments to the relevant AppKit view: struct CompareStringsIntent: AppIntent { static let title = LocalizedStringResource("intent.compare.strings.title") static let description = IntentDescription("intent.compare.strings.description") static let openAppWhenRun = true @Parameter(title: "activity.compare.files.original") var original: String @Parameter(title: "activity.compare.files.modified") var modified: String #if os(iOS) @Dependency private var openStrings: OpenStrings #endif func perform() async throws -> some IntentResult { Task { @MainActor in #if os(macOS) let delegate = (NSApp.delegate as! AppDelegate) ... #elseif os(iOS) openStrings.original = original openStrings.modified = modified openStrings.trigger = true #endif } return .result() } } And for iOS, which uses SwiftUI, I wasn't able to find a more elegant solution than using a trigger variable to signal that the intent should do something in the main app: struct CompareApp: App { private var openStrings = OpenStrings.shared init() { let openStrings = openStrings AppDependencyManager.shared.add(dependency: openStrings) } var body: some Scene { WindowGroup { ContentView() .environment(openStrings) } } } struct OpenStringsView: View { @Environment(OpenStrings.self) private var strings var body: some View { NavigationStack { Form { ... } .onChange(of: strings.trigger, { _, trigger in if trigger { strings.trigger = false compareStrings() } }) } } private func compareStrings() { task = Task { ... } } } @Observable final class OpenStrings: @unchecked Sendable { static let shared = OpenStrings() var original: String var modified: String var trigger = false init(original: String = "", modified: String = "") { self.original = original self.modified = modified } }
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to App Intent title and other localized strings not showing correctly in Shortcuts app on macOS 15
Even more confusing is that the following struct MyShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut(intent: MyIntent(), phrases: ["Do something in \(.applicationName)"], shortTitle: "Do something short", systemImageName: "doc") } } causes Do something in \(.applicationName) to appear in AppShortcuts.xcstrings, but Do something short to appear in Localizable.xcstrings. Is this expected?
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to App Intent title and other localized strings not showing correctly in Shortcuts app on macOS 15
I've now removed the App Intents Extension and moved the code to the main target. @available(macOS 13.0, *) struct MyShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut(intent: MyIntent(), phrases: ["Do something in \(.applicationName)"]) } } @available(macOS 13, *) struct MyIntent: AppIntent { static let title = LocalizedStringResource("intent.title") static let description = IntentDescription("intent.description") static let openAppWhenRun = true @Parameter(title: "intent.parameter.first") var first: String @Parameter(title: "intent.parameter.second") var second: String func perform() async throws -> some IntentResult { return .result() } } I've also created AppShortcuts.xcstrings in the main target. When I build the project, AppShortcuts.xcstrings only contains the string Do something in \(.applicationName), while all other strings (intent.title etc.) appear in Localizable.xcstrings. Is this expected? Previously, when I still had the separate App Intents Extension, I had all those strings in the same file, but when I renamed it to AppShortcuts.xcstrings and moved it to the main target I got several errors Invalid Utterance. Every App Shortcut utterance should have one '${applicationName}' in it. The errors went away when I only kept the string Do something in \(.applicationName), although I had to remove the others manually from the source code editor, since the string catalog editor always disables the buttons to add and remove strings in AppShortcuts.xcstrings.
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to App Intent title and other localized strings not showing correctly in Shortcuts app on macOS 15
[quote='818356022, DTS Engineer, /thread/770279?answerId=818356022#818356022'] App Shortcuts need to be in your main app target [/quote] I don't follow. Currently I have an App Intents extension as a separate target and the Shortcuts app lists the intents defined there, even without me defining anything in the main target. That's why I assumed you were talking about SwiftUI. If that's not the case, I don't understand what AppShortcutsProvider is meant for. What confuses me even more is that I have a different Xcode project with an App Intents extension that contains a Localizable.xcstrings file, and Shortcuts displays those string just fine.
Topic: App & System Services SubTopic: General Tags:
Jan ’25
Reply to getattrlistbulk lists same files over and over on macOS 15 Sequoia
Until now it seemed that the customer‘s very old hardware was the cause of this odd behaviour, but they just contacted me again telling me that they upgraded the hardware and the looping still happens. Latest Gigabyte motherboard and Intel i5-14400. All new hard drives – everything new. Latest Windows 11 Pro OS (formerly using Windows 10 Pro – 2 years ago latest update). Do you think it’s still the hardware, or macOS, or Windows?
Topic: App & System Services SubTopic: Core OS Tags:
Dec ’24