Search results for

“NSPersistentCloudKitContainer”

601 results found

Post

Replies

Boosts

Views

Activity

Reply to CloudKit + CoreData: Now how do I take advantage of CloudKit user-to-user sharing without losing CoreData + CloudKit synchronization?
Yes, It is not supported and you can use it, but have to write some extra code can be read as either saying the same thing, or contradicting each other, and after spending some hours looking through forums and documentation, without more context your intended meaning of NSPersistentCloudKitContainer does not yet support sharing isn't obvious to me. Contributing to my confusion, about a year ago the answer given included - https://developer.apple.com/forums/thread/117938?answerId=376835022#376835022: NSPersistentCloudKitContainer does not support sharing.... and As others have (correctly) pointed out, NSPersistentCloudKitContainer maintains a specific zone in the private database, and therefore will never see any shared zones owned by other users. Three weeks ago this answer - https://developer.apple.com/forums/thread/651651?answerId=616641022#616641022 also seems to say no: NSPersistentCloudKitContainer only supports the private database and the public database. If you wan
Jul ’20
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
are you aware of any behavioral changes in iOS 18 that causes an NSPersistentCloudKitContainer to delete data? Not that I am aware of. To be clear, NSPersistentCloudKitContainer does clean the data on the device if it gets notified of a change on the current logged-in Apple ID, but that has been the as-designed behavior since the very beginning. Note that it only cleans the local data; the data on CloudKit is still there, and will be synchronized back when the user logs back in with the same account, and so no data loss will happen. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Jan ’25
Reply to Toggle sync with NSPersistentCloudKitContainer
How do you set the store description to nil.....I see its key/value but I tried to set it on the description after loading the store and it says its read only? // MARK: - Core Data stack lazy var persistentContainer: NSPersistentCloudKitContainer = { /* The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. */ let container = NSPersistentCloudKitContainer(name: name) container.loadPersistentStores(completionHandler: { (storeDescription, error) in {tried to set it here storeDescription.options = nil}
Sep ’19
Reply to NSPersistentCloudKitContainer Import failed (incomprehensible archive)
Our general set of debugging / inspection Tech Notes are: https://developer.apple.com/documentation/technotes/tn3163-understanding-the-synchronization-of-nspersistentcloudkitcontainer https://developer.apple.com/documentation/technotes/tn3162-understanding-cloudkit-throttles https://developer.apple.com/documentation/technotes/tn3164-debugging-the-synchronization-of-nspersistentcloudkitcontainer If you set an exception breakpoint in Xcode you can probably capture call stack where the keyed archiver exception is thrown. That, the store files from the device having issues, and a sysdiagnose would make a good feedback report for further investigation. We include instructions for capture a sysdiagnose in TN3163.
Dec ’24
Reply to NSPersistentCloudKitContainer not syncing existing data
Nick, thanks for the input.Behaviours I've noticed...Scenario 1Existing Core Data app with existing records.Log in to the same Apple ID on different Simulators or Devices.Enable NSPersistentCloudKitContainer and include container.viewContext.automaticallyMergesChangesFromParent = trueOnly new records are synced to users CloudKit account and therefore across devices using the same Apple ID. Existing records remain only on the device on which they are created.Scenario 2Existing Core Data app with existing records.Log in to the same Apple ID on different Simulators or Devices.Enable NSPersistentCloudKitContainer and include container.viewContext.automaticallyMergesChangesFromParent = trueEnable NSPersistentHistoryTrackingKey... guard let containerStoreDescription = container.persistentStoreDescriptions.first else { fatalError((#function): Failed to retrieve a persistent store description.) } containerStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)ANY records
Dec ’19
Reply to NSFileProtection confusion
Here's a working snippet: container = NSPersistentCloudKitContainer(name: YourDataModelName) container.persistentStoreDescriptions.first!.setOption(FileProtectionType.complete as NSObject, forKey: NSPersistentStoreFileProtectionKey) container.loadPersistentStores(completionHandler: { (storeDescription, error) in ...
Topic: Privacy & Security SubTopic: General Tags:
Nov ’21
Reply to iPad os 18.1 iCloud error
For folks to be able to help, you might consider providing more context about your issue, like what Apple APIs you are using, how your app uses the APIs, how you trigger the issue, what the details of the error are. The log shows Core Data got involved. Assuming you are using Core Data + CloudKit, here are the technical resources that I believe can help debug the issue: TN3162: Understanding CloudKit throttles TN3163: Understanding the synchronization of NSPersistentCloudKitContainer TN3164: Debugging the synchronization of NSPersistentCloudKitContainer Sharing Core Data objects between iCloud users Best, —— Ziqiao Chen  Worldwide Developer Relations.
Aug ’24
Reply to CloudKit + CoreData: Now how do I take advantage of CloudKit user-to-user sharing without losing CoreData + CloudKit synchronization?
Yes, It is not supported and you can use it, but have to write some extra code can be read as either saying the same thing, or contradicting each other, and after spending some hours looking through forums and documentation, without more context your intended meaning of NSPersistentCloudKitContainer does not yet support sharing isn't obvious to me. Contributing to my confusion, about a year ago the answer given included - https://developer.apple.com/forums/thread/117938?answerId=376835022#376835022: NSPersistentCloudKitContainer does not support sharing.... and As others have (correctly) pointed out, NSPersistentCloudKitContainer maintains a specific zone in the private database, and therefore will never see any shared zones owned by other users. Three weeks ago this answer - https://developer.apple.com/forums/thread/651651?answerId=616641022#616641022 also seems to say no: NSPersistentCloudKitContainer only supports the private database and the public database. If you wan
Replies
Boosts
Views
Activity
Jul ’20
Reply to Using NSPersistentCloudKitContainer causes crash for iOS 14
I called NSPersistentCloudKitContainer multiple times in a controller, and the same problem occurred. After modifying the code, the instance was created only once, and then called multiple times, the problem was solved.
Replies
Boosts
Views
Activity
Mar ’21
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
are you aware of any behavioral changes in iOS 18 that causes an NSPersistentCloudKitContainer to delete data? Not that I am aware of. To be clear, NSPersistentCloudKitContainer does clean the data on the device if it gets notified of a change on the current logged-in Apple ID, but that has been the as-designed behavior since the very beginning. Note that it only cleans the local data; the data on CloudKit is still there, and will be synchronized back when the user logs back in with the same account, and so no data loss will happen. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Jan ’25
Reply to How to debug NSPersistentCloudKitContainer background updates?
I have the same question. I haven't been able to see any source explicitly state that NSPersistentCloudKitContainer sets the app to update its db while it is in the background, so I am starting to doubt it is even possible.
Replies
Boosts
Views
Activity
Sep ’20
Reply to CoreDataCloudKitDemo fails when creating a new Tag
I believe it might have something to do with NSSecureUnarchiveFromDataTransformerName, Core Data and CloudKit with NSPersistentCloudKitContainer. But I don't know why this would be in the unmodified demo from Apple? Any help much appreciated.
Replies
Boosts
Views
Activity
Jun ’21
Reply to Toggle sync with NSPersistentCloudKitContainer
How do you set the store description to nil.....I see its key/value but I tried to set it on the description after loading the store and it says its read only? // MARK: - Core Data stack lazy var persistentContainer: NSPersistentCloudKitContainer = { /* The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. */ let container = NSPersistentCloudKitContainer(name: name) container.loadPersistentStores(completionHandler: { (storeDescription, error) in {tried to set it here storeDescription.options = nil}
Replies
Boosts
Views
Activity
Sep ’19
Reply to NSPersistentCloudKitContainer Import failed (incomprehensible archive)
Our general set of debugging / inspection Tech Notes are: https://developer.apple.com/documentation/technotes/tn3163-understanding-the-synchronization-of-nspersistentcloudkitcontainer https://developer.apple.com/documentation/technotes/tn3162-understanding-cloudkit-throttles https://developer.apple.com/documentation/technotes/tn3164-debugging-the-synchronization-of-nspersistentcloudkitcontainer If you set an exception breakpoint in Xcode you can probably capture call stack where the keyed archiver exception is thrown. That, the store files from the device having issues, and a sysdiagnose would make a good feedback report for further investigation. We include instructions for capture a sysdiagnose in TN3163.
Replies
Boosts
Views
Activity
Dec ’24
Reply to NSPersistentCloudKitContainer not syncing existing data
Nick, thanks for the input.Behaviours I've noticed...Scenario 1Existing Core Data app with existing records.Log in to the same Apple ID on different Simulators or Devices.Enable NSPersistentCloudKitContainer and include container.viewContext.automaticallyMergesChangesFromParent = trueOnly new records are synced to users CloudKit account and therefore across devices using the same Apple ID. Existing records remain only on the device on which they are created.Scenario 2Existing Core Data app with existing records.Log in to the same Apple ID on different Simulators or Devices.Enable NSPersistentCloudKitContainer and include container.viewContext.automaticallyMergesChangesFromParent = trueEnable NSPersistentHistoryTrackingKey... guard let containerStoreDescription = container.persistentStoreDescriptions.first else { fatalError((#function): Failed to retrieve a persistent store description.) } containerStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)ANY records
Replies
Boosts
Views
Activity
Dec ’19
Reply to Passing Data to Widget
Can we access NSPersistentCloudKitContainer in the same way we do from the app, or will we need still need App Groups? I don't think CloudKit containers work with App Groups.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’20
Reply to NSFileProtection confusion
Here's a working snippet: container = NSPersistentCloudKitContainer(name: YourDataModelName) container.persistentStoreDescriptions.first!.setOption(FileProtectionType.complete as NSObject, forKey: NSPersistentStoreFileProtectionKey) container.loadPersistentStores(completionHandler: { (storeDescription, error) in ...
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to NSPersistentCloudKitContainer causes crash on watchOS when device is offline
Can you share the crash log? Or file a feedback report with it attached and a sysdiagnose from the affected device? TN3163: Understanding the synchronization of NSPersistentCloudKitContainer | Apple Developer Documentation
Replies
Boosts
Views
Activity
Jun ’25
Reply to iPad os 18.1 iCloud error
For folks to be able to help, you might consider providing more context about your issue, like what Apple APIs you are using, how your app uses the APIs, how you trigger the issue, what the details of the error are. The log shows Core Data got involved. Assuming you are using Core Data + CloudKit, here are the technical resources that I believe can help debug the issue: TN3162: Understanding CloudKit throttles TN3163: Understanding the synchronization of NSPersistentCloudKitContainer TN3164: Debugging the synchronization of NSPersistentCloudKitContainer Sharing Core Data objects between iCloud users Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Aug ’24
Reply to Display UI when NSPersistentCloudKitContainer begins and ends a sync
I have consulted the documentation here: https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer/event?changes=latest_minor however there is no information that describes how this event works, can I expect documentation in the future?
Replies
Boosts
Views
Activity
Jun ’20
Reply to SwiftUI Xcode 12 Core Data FetchRequest issues
If you Changed the name of your .xcdatamodel file ensure that the same name you changed it to is used when making your container in AppDelegate.swift as below let container = NSPersistentCloudKitContainer(name: Same Name )
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’20
Reply to cloudkit sync not getting cloudkit updates
Apparently does not work on simulator only actual devices. See this from Andrew Bancroft https://www.andrewcbancroft.com/blog/ios-development/data-persistence/getting-started-with-nspersistentcloudkitcontainer/
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’19