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?
Post
Replies
Boosts
Views
Activity
Yes, I've already tried GKMatchmakerViewController(invite: invite) as the sample code above also demonstrates. I was already asked this question in FB15864883 1 month ago.
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
}
}
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?
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.
I'm glad to see how developer support changed in the last years, and now in particular. I think offering support on the forums that everyone can see and then allowing to request free support via TSI when the forum doesn't help is going to resolve a lot of the problems that I personally had with TSI.
[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.
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?
I'm having the same issue. I tried increasing the build number and still the build appears shortly on the website in the "Processing" state, and then disappears. After the first upload I got an email with an error message, which I resolved and haven't got any email since, but still any uploaded build is not listed on the website. Then I tried increasing the version string from 1.0 to 1.0.1 and the build number as well, and after reloading the website it showed a disclosure indicator with the label 1.0.1, but completely empty. After reloading the website one more time, even this indicator was gone again, and the website is completely empty like at the start of this whole experiment.
[quote='818356022, DTS Engineer, /thread/770279?answerId=818356022#818356022']
App Shortcuts need to be in your main app target
[/quote]
I have a non-SwiftUI app, so I guess this doesn't apply? I don't see how I could have App Shortcuts without a separate App Intents Extension.
Is this AppShortcuts.xcstrings officially documented? I couldn't find it anywhere.
[quote='818239022, DTS Engineer, /thread/764435?answerId=818239022#818239022']
The app is running for a significant period of time.
[/quote]
I had launched the app at most a couple hours earlier. I had the app running for weeks before and never had this issue.
I just had this issue again on my own Mac with macOS 15.2. My app had been active for a while and had been able to resolve bookmarks. Then suddenly when trying to create new bookmarks I got the usual error. Restarting the app solved the issue.
Do you mean to the main target or the app extension? And should I keep the existing Localizable.xcstrings or delete it?
Here's a link to a sample project: https://www.swisstransfer.com/d/e8ad8888-ae2e-4371-8e82-0d5915c967c7
I really just created an empty macOS App project, added a target App Intents Extension named CompareIntent, and pasted the code I provided above in the CompareIntent.swift file. Then I build the project and copied the app into my Applications folder, and I can still reproduce the issue when running the app intent in Shortcuts.
[quote='817975022, DTS Engineer, /thread/767019?answerId=817975022#817975022']
Dispatching to the main thread (with a Swift Task) is an anti-pattern in this case
[/quote]
Correct, and as I mentioned, this poses the question of how to avoid race conditions when accessing my custom data needed both in SceneKit and in SpriteKit (since the first uses its own thread, and the latter is annotated @MainActor).