So, I'm guessing there is no answer and this is a bug with the current implementation of SwiftUI for macOS?
Post
Replies
Boosts
Views
Activity
Any possible answers? I can't find anything anywhere.
I'm hoping this is a bug that will get fixed in the upcoming versions of SwiftUI...
I had hopes that Xcode 14, macOS Monterrey and the latest Swiftui 5.7 would fix this, but no...
This was fixed on Ventura.
So, I found a few answers in https://medium.com/macos-app-development/using-cloudkit-on-macos-app-2647cb0f91d6
I added com.apple.developer.icloud-container-environment to the entitlements and set to production and now when I run the app in debug mode, it syncs with my production container. However, when I export and sign the app (via Xcode Archive -> Distribute App -> Developer ID) then again it doesn't sync.
I'm trying to figure out what else am I missing? There seem to be no documentation anywhere.
Well, the answer was simple and yet hard to find. It seems when you convert a Core Data app to work with CloudKit you need to add CloudKit.framework to the Frameworks, Libraries, and Embedded Content section. without it, the app will work when running in debug mode (via Xcode) but once it's in production, signed and notarized, it won't. Even if you have the right entitlements, all pointing to production, etc.
Same, but with the searchbar:
"Thread 1: "NSToolbar 0x6000001c74e0 already contains an item with the identifier com.apple.SwiftUI.search. Duplicate items of this type are not allowed.""
This started as soon as I updates to Xcode Version 16.0
The "offending" code:
NavigationSplitView {
...
}
.searchable(
text: $searchText,
placement: .automatic,
prompt: "Search..."
)