Post

Replies

Boosts

Views

Activity

Reply to App Group Not working as intended after updating to macOS 15 beta.
FWIW, the above solution wasn't working for me. Claude helped me with the following, and it successfully got rid of the prompt, and after a minute, started syncing with iCloud and is once again in sync with my iOS and watchOS versions: Keep your existing App Group identifier (group.com.xxxxxxx.appName) as it is. This will work for both iOS and macOS. No need to create a separate entitlements file for Mac and do the conditional compiling. Instead of changing the App Group identifier, we'll modify how we access the shared container on macOS: Create a new Swift file called AppGroupHelper.swift and add the following code: import Foundation enum AppGroupHelper { static var containerURL: URL? { #if os(macOS) return FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent("Library/Containers/com.companyName.AppName/Data/Documents") #else return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.companyName.appName") #endif } } Update your CoreDataStack to use this helper: lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: "appName") if let storeURL = AppGroupHelper.containerURL?.appendingPathComponent("appName.sqlite") { let description = NSPersistentStoreDescription(url: storeURL) description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) container.persistentStoreDescriptions = [description] } container.loadPersistentStores { (storeDescription, error) in if let error = error as NSError? { print("Unresolved error \(error), \(error.userInfo)") } else { print("Core Data stack has been initialized with description: \(storeDescription)") } } return container }() For macOS, you'll need to ensure that your app has the necessary entitlements to access its container directory. Add the following to your appName.entitlements file: <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.files.user-selected.read-write</key> <true/> This approach should resolve the warning on macOS Sonoma while maintaining functionality on both platforms. It uses the app's container directory on macOS instead of the shared App Group container, which should avoid the permissions issue.
Oct ’24