Search results for

“NSPersistentCloudKitContainer”

601 results found

Post

Replies

Boosts

Views

Activity

Reply to Async Data with iCloud
Given that you are already using Core Data, you can consider using NSPersistentCloudKitContainer. If the data you would synchronize is as simple as several values, you can consider using the CloudKit framework as well, which gives you more flexibility. You might want to start with looking into the above APIs, and follow up with your further questions, if any. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Feb ’25
Reply to Cloudkit not synching across devices after latest ios update
What CloudKit API are you using? If you are using NSPersistentCloudKitContainer, I'd suggest that you start with the following technotes: TN3163: Understanding the synchronization of NSPersistentCloudKitContainer TN3164: Debugging the synchronization of NSPersistentCloudKitContainer If you are using the CloudKit framework, start with: TN3162: Understanding CloudKit throttles The general methodology to debug a CloudKit synchronization issue is to capture and analyze a sysdiagnose, and try to find relevant CloudKit errors from there. If you did find an error and need further discussion, please post the detailed error message here for folks to take a look. In any case, if you believe that CloudKit should be improved in some way, please feel free to provide actionable feedback for the CloudKit folks to consider. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Feb ’25
CloudKit Sharing Issue: "Unknown client: ChoreOrganizer"
I'm experiencing a persistent issue with CloudKit sharing in my iOS application. When attempting to present a UICloudSharingController, I receive the error message Unknown client: ChoreOrganizer in the console. App Configuration Details: App Name: ChoreOrganizer Bundle ID: com.ProgressByBits.ChoreOrganizer CloudKit Container ID: iCloud.com.ProgressByBits.ChoreOrganizer Core Data Model Name: ChoreOrganizer.xcdatamodeld Core Data Entity: Chore Error Details: The error Unknown client: ChoreOrganizer occurs when I present the UICloudSharingController This happens only on the first attempt to share; subsequent attempts during the same app session don't show the error but sharing still doesn't work All my code executes successfully without errors until UICloudSharingController is presented Implementation Details: I'm using NSPersistentCloudKitContainer for Core Data synchronization and UICloudSharingController for sharing. My implementation creates a custom CloudKit zone, saves both a record and a CKShare
5
0
729
Feb ’25
Reply to PlaygroundSupport no longer available for Playground apps
Since Swift Playground 4.6, as you have observed, it is no longer possible to import PlaygroundSupport because the PlaygroundSupport framework provides no functionality to app playgrounds. However, starting in Swift Playground 4.6, you can conditionalize code with the SwiftPlaygrounds condition: #if SwiftPlaygrounds container = NSPersistentContainer(name: myApp, managedObjectModel: Self.createModel()) #else container = NSPersistentCloudKitContainer(name: myApp) #endif
Feb ’25
PlaygroundSupport no longer available for Playground apps
In Swift Playground 4.6.2 the package PlaygroundSupport is no longer available to Playground apps. The following test previously permitted apps run in the Playground vs compiled in XCode to support different behavior: #if canImport(PlaygroundSupport) container = NSPersistentContainer(name: myApp, managedObjectModel: Self.createModel()) #else container = NSPersistentCloudKitContainer(name: myApp) #endif Since Swift Playground 4.6.2 the PlaygroundSupport package is no longer available for app projects in Playgrounds. Is there a different compile type test which can be used to differentiate compilation for Swift Playground apps ? I am currently having to use a runtime workaround (below) but would prefer a compile time test is an alternative is available. public static var inPlayground: Bool { if Bundle.allBundles.contains(where: { ($0.bundleIdentifier ?? ).contains(swift-playgrounds) }) { return true } else { return false } }
1
0
661
Feb ’25
NSPersistentCloudKitContainer uploads only a subset of records to public database in production environment
I'm having some issues where only a subset of records appear in CloudKit dashboard after I have saved some records in my iOS app using NSPersistentCloudKitContainer. I have noticed that when I'm running my app using the development environment of my CloudKit container everything works smoothly and is uploaded as expected but when I'm using the production environment only a subset of records are actually uploaded. I'm pulling my hair on how to debug this. -com.apple.CoreData.CloudKitDebug and -com.apple.CoreData.SQLDebug pukes out too much info in the console for me to pinpoint any issue.
1
0
713
Feb ’25
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
This issue is still ongoing. Thus far we have not been able to figure out what is going on but have reduced complaints quite a bit by rolling back to minimum OS / Devkit of iOS 17. So it is some kind of bug or behavioral issue with iOS 18 SDK. We cannot find a pattern to it other than that most users are in Europe and are not using iCloud to backup. This means we are using the NSPersistentCloudKitContainer regardless of if users enable or do not enable iCloud usage. This might be the root so if anyone is aware of what might have changed in iOS 18 that would do this PLEASE let me know. We have also now default always enable iCloud usage without asking if we find an account present. They can turn it off (with big warnings) if they want but we no longer ask on launch. Also we will investigate not always using NSPersistentCloudKitContainer if iCloud is not used.
Feb ’25
CoreData error=134100 Failed to open the store
Hello, I'm using CoreData + CloudKit and I am facing the following error 134100 The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store. All my schema updates are composed of adding optional attributes to existing entities, adding non-optional attributes (with default value) to existing entities or adding new entities Basically, only things that lightweight migrations can handle. Every time I update the schema, I add a new model version of xcdatamodel - who only has a single configuration (the Default one). And I also deploy the updated CloudKit schema from the dashboard. It worked up to v3 of my xcdatamodel, but started to crash for a few users at v4 when I added 16 new attributes (in total) to 4 existing entities. Then again at v5 when I added 2 new optional attributes to 1 existing entity. I'm using a singleton and here is the code: private func generateCloudKitContainer() -> NSPersistentCloudKitContainer { let
4
0
974
Feb ’25
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
Well something changed since we switched to iOS 18 SDK and it definitely did not work this way in earlier versions of iOS. At some point after iOS 15 SDK something changed and the cleaning process you mentioned is literally wiping users data and if it was never in iCloud in the first place it is totally gone now?! We have always used an NSPersistentCloudKitContainer since we first implemented it years back regardless of if the person enabled iCloud (in our App or not). This was based on statements Apple Engineers made in the past that you could always use NSPersistentCloudKitContainer since it was subclass of nspersistentcontainer and with History on but options set to nil for NOT ALLOWED. But now it seems that users running iOS 18 and who did not allow us to use iCloud (are getting data wiped). It is not clear if they are entirely logged out of iCloud or just have iCloud Drive off or what, but something is different in iOS 18. I really need a way to zero in on what is going on. This is one
Jan ’25
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 MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
Ziqiao are you aware of any behavioral changes in iOS 18 that causes an NSPersistentCloudKitContainer to delete data? In past we were told it could be used in all cases with history on, even if user was not allowing cloudkit. This was true until iOS 18 it seems now if that initializes and user is not using iCloud would it delete data. I thought I was seeing people talking about that and that it does that for security. if That is true that is a huge damn change and which Apple should tell people about?!
Jan ’25
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
Is there a way to get the container from a device NOT having Xcode or Development tools if they can connect to a Mac? Not that I am aware of. Many of whom DO NOT use iCloud which is also weird. A few using iCloud but most are NOT. Any thoughts on why that might be? If the impacted users didn't use iCloud, you can rule out CloudKit, which will simplify the issue a bit. However, I still can't say anything for sure – Debugging a random data loss can be hard and my sitting here and guessing won't be helpful. To eventually figure it out, you might consider reaching out the impacted users to hopefully find more hints, or ideally, create a reproducible case. now it is almost as if a user has NSPersistentCloudKitContainer options set to nil and the data is deleted. Can you confirm or provide a link to documentation confirming? Setting the CloudKit option to nil does not delete the data in the existing Core Data store. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Jan ’25
Reply to SwiftData & CloudKit: Deduplication Logic
SwiftData and CloudKit are two different frameworks, and so you are free to use both of them in your app. Note that CloudKit here means the CloudKit framework, not NSPersistentCloudKitContainer. As of today, when you configure SwiftData to use CloudKit, as mentioned in here, SwiftData uses NSPersistentCloudKitContainer underneath to sync the data, and so you won't want to create your own NSPersistentCloudKitContainer instance for the purpose. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Jan ’25
Reply to CloudKit sync stopped working with error „You can't save and delete the same record"
Thanks for the reply! Firstly, correct, we're using CoreData + CloudKit and mirrored relationships means reflexive relationships (e.g., Article.similarArticles whereby both are of the type Article). Assuming that you are using Data + CloudKit, I am guessing that this can be triggered by your code and data. Regrettably, that doesn't seem to be the case, also given the Delete Rule is Nullify. Digging through our old messages, we found out that we had already reported this very same issue a couple of years ago with a similar data model but where no entity was ever deleted. At that time we filed feedback report 9118745 and we were told that this was likely a bug. it is worth filing a feedback report for the Core Data team Given this seems to be the very same issue, I’ve added the information of this post to our above ticket (and have provided the relevant system diagnose logs, data model, etc. there too). Does your Core Data model indeed has the reflexive relationship? If yes, has it been there for long time, or
Jan ’25
Reply to Async Data with iCloud
Given that you are already using Core Data, you can consider using NSPersistentCloudKitContainer. If the data you would synchronize is as simple as several values, you can consider using the CloudKit framework as well, which gives you more flexibility. You might want to start with looking into the above APIs, and follow up with your further questions, if any. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Feb ’25
Reply to Cloudkit not synching across devices after latest ios update
What CloudKit API are you using? If you are using NSPersistentCloudKitContainer, I'd suggest that you start with the following technotes: TN3163: Understanding the synchronization of NSPersistentCloudKitContainer TN3164: Debugging the synchronization of NSPersistentCloudKitContainer If you are using the CloudKit framework, start with: TN3162: Understanding CloudKit throttles The general methodology to debug a CloudKit synchronization issue is to capture and analyze a sysdiagnose, and try to find relevant CloudKit errors from there. If you did find an error and need further discussion, please post the detailed error message here for folks to take a look. In any case, if you believe that CloudKit should be improved in some way, please feel free to provide actionable feedback for the CloudKit folks to consider. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Feb ’25
CloudKit Sharing Issue: "Unknown client: ChoreOrganizer"
I'm experiencing a persistent issue with CloudKit sharing in my iOS application. When attempting to present a UICloudSharingController, I receive the error message Unknown client: ChoreOrganizer in the console. App Configuration Details: App Name: ChoreOrganizer Bundle ID: com.ProgressByBits.ChoreOrganizer CloudKit Container ID: iCloud.com.ProgressByBits.ChoreOrganizer Core Data Model Name: ChoreOrganizer.xcdatamodeld Core Data Entity: Chore Error Details: The error Unknown client: ChoreOrganizer occurs when I present the UICloudSharingController This happens only on the first attempt to share; subsequent attempts during the same app session don't show the error but sharing still doesn't work All my code executes successfully without errors until UICloudSharingController is presented Implementation Details: I'm using NSPersistentCloudKitContainer for Core Data synchronization and UICloudSharingController for sharing. My implementation creates a custom CloudKit zone, saves both a record and a CKShare
Replies
5
Boosts
0
Views
729
Activity
Feb ’25
Reply to PlaygroundSupport no longer available for Playground apps
Since Swift Playground 4.6, as you have observed, it is no longer possible to import PlaygroundSupport because the PlaygroundSupport framework provides no functionality to app playgrounds. However, starting in Swift Playground 4.6, you can conditionalize code with the SwiftPlaygrounds condition: #if SwiftPlaygrounds container = NSPersistentContainer(name: myApp, managedObjectModel: Self.createModel()) #else container = NSPersistentCloudKitContainer(name: myApp) #endif
Replies
Boosts
Views
Activity
Feb ’25
PlaygroundSupport no longer available for Playground apps
In Swift Playground 4.6.2 the package PlaygroundSupport is no longer available to Playground apps. The following test previously permitted apps run in the Playground vs compiled in XCode to support different behavior: #if canImport(PlaygroundSupport) container = NSPersistentContainer(name: myApp, managedObjectModel: Self.createModel()) #else container = NSPersistentCloudKitContainer(name: myApp) #endif Since Swift Playground 4.6.2 the PlaygroundSupport package is no longer available for app projects in Playgrounds. Is there a different compile type test which can be used to differentiate compilation for Swift Playground apps ? I am currently having to use a runtime workaround (below) but would prefer a compile time test is an alternative is available. public static var inPlayground: Bool { if Bundle.allBundles.contains(where: { ($0.bundleIdentifier ?? ).contains(swift-playgrounds) }) { return true } else { return false } }
Replies
1
Boosts
0
Views
661
Activity
Feb ’25
Reply to SwiftData with shared and private containers
+1 I've built an app using CoreData + CloudKit and now I have to rewrite everything using NSPersistentCloudKitContainer.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’25
NSPersistentCloudKitContainer uploads only a subset of records to public database in production environment
I'm having some issues where only a subset of records appear in CloudKit dashboard after I have saved some records in my iOS app using NSPersistentCloudKitContainer. I have noticed that when I'm running my app using the development environment of my CloudKit container everything works smoothly and is uploaded as expected but when I'm using the production environment only a subset of records are actually uploaded. I'm pulling my hair on how to debug this. -com.apple.CoreData.CloudKitDebug and -com.apple.CoreData.SQLDebug pukes out too much info in the console for me to pinpoint any issue.
Replies
1
Boosts
0
Views
713
Activity
Feb ’25
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
This issue is still ongoing. Thus far we have not been able to figure out what is going on but have reduced complaints quite a bit by rolling back to minimum OS / Devkit of iOS 17. So it is some kind of bug or behavioral issue with iOS 18 SDK. We cannot find a pattern to it other than that most users are in Europe and are not using iCloud to backup. This means we are using the NSPersistentCloudKitContainer regardless of if users enable or do not enable iCloud usage. This might be the root so if anyone is aware of what might have changed in iOS 18 that would do this PLEASE let me know. We have also now default always enable iCloud usage without asking if we find an account present. They can turn it off (with big warnings) if they want but we no longer ask on launch. Also we will investigate not always using NSPersistentCloudKitContainer if iCloud is not used.
Replies
Boosts
Views
Activity
Feb ’25
CoreData error=134100 Failed to open the store
Hello, I'm using CoreData + CloudKit and I am facing the following error 134100 The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store. All my schema updates are composed of adding optional attributes to existing entities, adding non-optional attributes (with default value) to existing entities or adding new entities Basically, only things that lightweight migrations can handle. Every time I update the schema, I add a new model version of xcdatamodel - who only has a single configuration (the Default one). And I also deploy the updated CloudKit schema from the dashboard. It worked up to v3 of my xcdatamodel, but started to crash for a few users at v4 when I added 16 new attributes (in total) to 4 existing entities. Then again at v5 when I added 2 new optional attributes to 1 existing entity. I'm using a singleton and here is the code: private func generateCloudKitContainer() -> NSPersistentCloudKitContainer { let
Replies
4
Boosts
0
Views
974
Activity
Feb ’25
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
Well something changed since we switched to iOS 18 SDK and it definitely did not work this way in earlier versions of iOS. At some point after iOS 15 SDK something changed and the cleaning process you mentioned is literally wiping users data and if it was never in iCloud in the first place it is totally gone now?! We have always used an NSPersistentCloudKitContainer since we first implemented it years back regardless of if the person enabled iCloud (in our App or not). This was based on statements Apple Engineers made in the past that you could always use NSPersistentCloudKitContainer since it was subclass of nspersistentcontainer and with History on but options set to nil for NOT ALLOWED. But now it seems that users running iOS 18 and who did not allow us to use iCloud (are getting data wiped). It is not clear if they are entirely logged out of iCloud or just have iCloud Drive off or what, but something is different in iOS 18. I really need a way to zero in on what is going on. This is one
Replies
Boosts
Views
Activity
Jan ’25
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 MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
Ziqiao are you aware of any behavioral changes in iOS 18 that causes an NSPersistentCloudKitContainer to delete data? In past we were told it could be used in all cases with history on, even if user was not allowing cloudkit. This was true until iOS 18 it seems now if that initializes and user is not using iCloud would it delete data. I thought I was seeing people talking about that and that it does that for security. if That is true that is a huge damn change and which Apple should tell people about?!
Replies
Boosts
Views
Activity
Jan ’25
Reply to MAJOR Core Data Issues with iOS 18 and sdk - Data Missing for many users?!
Is there a way to get the container from a device NOT having Xcode or Development tools if they can connect to a Mac? Not that I am aware of. Many of whom DO NOT use iCloud which is also weird. A few using iCloud but most are NOT. Any thoughts on why that might be? If the impacted users didn't use iCloud, you can rule out CloudKit, which will simplify the issue a bit. However, I still can't say anything for sure – Debugging a random data loss can be hard and my sitting here and guessing won't be helpful. To eventually figure it out, you might consider reaching out the impacted users to hopefully find more hints, or ideally, create a reproducible case. now it is almost as if a user has NSPersistentCloudKitContainer options set to nil and the data is deleted. Can you confirm or provide a link to documentation confirming? Setting the CloudKit option to nil does not delete the data in the existing Core Data store. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Jan ’25
Reply to SwiftData & CloudKit: Deduplication Logic
SwiftData and CloudKit are two different frameworks, and so you are free to use both of them in your app. Note that CloudKit here means the CloudKit framework, not NSPersistentCloudKitContainer. As of today, when you configure SwiftData to use CloudKit, as mentioned in here, SwiftData uses NSPersistentCloudKitContainer underneath to sync the data, and so you won't want to create your own NSPersistentCloudKitContainer instance for the purpose. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Jan ’25
Reply to CloudKit sync stopped working with error „You can't save and delete the same record"
Thanks for the reply! Firstly, correct, we're using CoreData + CloudKit and mirrored relationships means reflexive relationships (e.g., Article.similarArticles whereby both are of the type Article). Assuming that you are using Data + CloudKit, I am guessing that this can be triggered by your code and data. Regrettably, that doesn't seem to be the case, also given the Delete Rule is Nullify. Digging through our old messages, we found out that we had already reported this very same issue a couple of years ago with a similar data model but where no entity was ever deleted. At that time we filed feedback report 9118745 and we were told that this was likely a bug. it is worth filing a feedback report for the Core Data team Given this seems to be the very same issue, I’ve added the information of this post to our above ticket (and have provided the relevant system diagnose logs, data model, etc. there too). Does your Core Data model indeed has the reflexive relationship? If yes, has it been there for long time, or
Replies
Boosts
Views
Activity
Jan ’25