Search results for

“NSPersistentCloudKitContainer”

601 results found

Post

Replies

Boosts

Views

Activity

NSPersistentCloudKitContainer with public database and pre-seeded data
I wonder if anyone has managed to get NSPersistentCloudKitContainer with a public database with a pre-seeded sqlite to work. Our app has a few thousand records held in coredata that I'd like to move to cloudkit so that when we add new data it gets shared by everyone. Currently the only way to do this is by throwing up a new version to the app store with a new sqlite database embedded inside. NSPersistentCloudKitContainer seemed like the way to go. But I cannot get it to work with pre seeded data. It seems it works fine if I download it to a device with the same apple id as added the original data. The data is there ready as soon as it's installed and new data syncs with the device. But if I install the app onto a device with a different apple id than the original seeder it deletes all the data and starts downloading it fresh from the server. This would be fine but if the data is not there when the app launches it crashes as it's critical to the app and I can't pause the app launch until it's
1
0
887
Aug ’21
Reply to NSPersistentCloudkitContainer Memory Leak -> Crash? (iOS 15 beta 4 & 5)
I bought a new iPad and using my app (downloaded from the App Store, not via Xcode) I can confirm that: Data created/modified on iOS 14.7.1 successfully syncs bidirectionally on iOS 14.7.1 devices Data created/modified on iOS 14.7.1 successfully syncs down only to iOS 15 (beta 4, 5 or 6) devices Data created/modified on iOS 15 (beta 4, 5 or 6) does not upload to iCloud (and eventually crashes the App)^ In order to see the iOS 14.7.1 -> iOS 15 (beta) changes appear I have to reload the app as the download seems to occur before the upload. Once the upload task 'starts' (it never really actually uploads anything), it prevents any changes from downloading. I've made no changes to my code, data model or NSPersistentCloudkitContainer related methods and it was something that abruptly appeared after installing iOS 15 beta 4. ^ basically any changes made on the device after iOS 15 (beta 4) was installed have not ever been sent to iCloud.
Aug ’21
SwiftUI TextField present integer (Int64) for macOS target
NumberFormatter does not function as expected under Xcode 13 betas or macOS 12 betas (currently up to beta 5 for both). I've logged feedback to Apple FB9423179. I'm writing a SwiftUI universal app with macOS and iOS targets using Core Data and NSPersistentCloudKitContainer. A Core Data Entity is an Observed Object in the code for a detail View. e.g. @ObservedObject var account: Account where Account is the class. NumberFormatter currently does not function in a TextField on macOS 12, so as a workaround I am currently using with great success: TextField(Sort Order, text: Binding( get: { String(account.sortOrder) }, set: { account.sortOrder = Int64($0.filter{0123456789.contains($0)})! } ) ) where sortOrder an entity attribute of type Optional. This works well for number entry and in my humble opinion is elegant in that it is immediately obvious what the TextField is expected to do to get the information it displays and set the information provided by the user. The only issue is that when the user makes
5
0
2k
Aug ’21
Reply to App getting killed by iOS while NSPersistentCloudKitContainer syncs
I'm facing a the same problem. In my case I'm collecting data in background mode. If internet connection gets lost, large amount of data might be sync when the device gets back on the internet. If data collection is still active, the background mode seems to keep NSPersistentCloudKitContainer alive resulting in the iCloud sync not being terminated and the app getting killed due to high CPU pressure. What framework are you using? I'm using SwiftUI. I'm also still looking for a solution.
Aug ’21
Reply to iOS 15 beta 4 CloudKit Auth Error
This is NOT fixed with beta 5. Two problems related to NSPersistentCloudkitContainer persist since beta 4. I've submitted a bug report to Apple - no response yet. The issues: Account temporarily unavailable due to bad or missing auth token when using the Development Environment (device or simulator), despite being signed in and despite it working on beta 1, 2 & 3. When using the App Store version of my App (in the Production Environment) on an iOS 15 device (beta 4 & 5), the syncing appears to start but nothing syncs. The app crashes to the springboard after a minute without warning. Crash reports are vague but I have captured a CloudKit sysdiagnose and sent it to Apple in the hope they can decipher it. I really hope they sort this out as it's going to render my currently available app useless if iOS15 is released in this state and my users install it.
Aug ’21
Detect/Receive CloudKit CoreData Errors
In development I've switched to NSPersistentCloudKitContainer and have begun the terrifying process of trying to test as many scenarios as possible to make sure nobody loses any data. During some testing I saw an error like this: I was able to fix this, but it was only affecting some scenarios and if this had happened to a real user they (and I) would never have known about the problem, and their data would not have synced to CloudKit. If the store fails to load you get an error, but if it loads but doesn't sync you don't. So my question is: is there a way to receive these kind of errors in code? I have looked for notifications and delegate methods and I can't find any.
1
0
1.2k
Aug ’21
Reply to Is Core Data hosted in CloudKit working in Xcode 13?
Seems like a new issue in Beta 4 resulting in this error: Account Temporarily Unavailable (1028/2011); Account temporarily unavailable due to bad or missing auth token 'Reset All Contents & Settings' on the simulator doesn't appear to fix it this time. I've also noticed that the current App Store release version of my App which uses NSPersistentCloudKitContainer does not sync properly and crashes after 30 seconds. Nothing has changed other than installing Beta 4. I've submitted a bug report to Apple.
Jul ’21
How to clean up old NSPersistentStore files after migrating Core Data with CloudKit to App Group container
Hi, I’m trying to migrate Core Data with CloudKit to the shared App Group Container so that widgets can get access to it. So far, I’ve managed to do so with the following code: init() { container = NSPersistentCloudKitContainer(name: “AppName”) let storeDescription = container.persistentStoreDescriptions.first! // Clean up code goes here (explained later) // ... let sharedGroupStoreURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: group.com.XXX)!.appendingPathComponent(AppName.sqlite) storeDescription.url = sharedGroupStoreURL container.loadPersistentStores { (storeDescription, error) in if let error = error as NSError? { print(Unresolved error (error), (error.userInfo)) } } container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy container.viewContext.automaticallyMergesChangesFromParent = true } This tells Core Data to use the shared container. When the new persistentStore loads, it gets seamlessly populated with the data from CloudKit. So far, so good
1
0
705
Jul ’21
Is it safe to use a NSPersistentCloudKitContainer on a Share Extension?
I have an app that uses NSPersistentCloudKitContainer to store all the data so it's backed by iCloud and synced between devices. Such app has a Share Extension, that can be triggered both from iOS (and iPadOS) and macOS (Catalyst). I was wondering if it's safe to instantiate an NSPersistentCloudKitContainer from a Share Extension due to it being very short lived. At the moment, I'm sending the data straight to iCloud instead of instantiating an NSPersistentCloudKitContainer, but it feels wrong because I'm using the keys that NSPersistentCloudKitContainer created internally (CD_MyEntity, CD_myProperty, etc.) to send it to iCloud and then being correctly pulled by my clients. The only concern that I have is that bringing up an NSPersistentCloudKitContainer that has to pull data, might delay or even loose the data that I'm saving right now because it gets killed after some amount of time since the share action has been completed. Any insights will be much appreciated,
3
0
2.2k
Jul ’21
Add NSManagedObject to existing CKShare
Using NSPersistentCloudKitContainer, how do I add (or modify) the NSManageObjects that are part of a Share/Zone? I have initially created a CKShare using NSPersistentCloudKitContainer.share(_:to:completion:), how can I add objects to that share later on? Calling the method again (with to:existingShare filed), always seems to create a new Share. In fact, I don't understand what the to: parameter is for? It doesn't matter if I set it or not, a new CKShare is always created.
3
0
1.1k
Jul ’21
Reply to Manually define a CKRecord ID for a given NSManagedObject instance
hi, since you are using NSPersistentCloudKitContainer, you might want to take a look at Apple's page on Linking Data Between Two Core Data Stores. this provides a mechanism so that you can load up what i think you are calling base values in a local store, separate from the store that is mirrored to iCloud. this would solve the problem of loading base values on one machine, moving them into the cloud, and then trying to figure out on a second device how to prevent them from being reloaded from iCloud. hope that helps, DMG
Jul ’21
NSPersistentCloudKitContainer with public database and pre-seeded data
I wonder if anyone has managed to get NSPersistentCloudKitContainer with a public database with a pre-seeded sqlite to work. Our app has a few thousand records held in coredata that I'd like to move to cloudkit so that when we add new data it gets shared by everyone. Currently the only way to do this is by throwing up a new version to the app store with a new sqlite database embedded inside. NSPersistentCloudKitContainer seemed like the way to go. But I cannot get it to work with pre seeded data. It seems it works fine if I download it to a device with the same apple id as added the original data. The data is there ready as soon as it's installed and new data syncs with the device. But if I install the app onto a device with a different apple id than the original seeder it deletes all the data and starts downloading it fresh from the server. This would be fine but if the data is not there when the app launches it crashes as it's critical to the app and I can't pause the app launch until it's
Replies
1
Boosts
0
Views
887
Activity
Aug ’21
Reply to NSPersistentCloudkitContainer Memory Leak -> Crash? (iOS 15 beta 4 & 5)
I bought a new iPad and using my app (downloaded from the App Store, not via Xcode) I can confirm that: Data created/modified on iOS 14.7.1 successfully syncs bidirectionally on iOS 14.7.1 devices Data created/modified on iOS 14.7.1 successfully syncs down only to iOS 15 (beta 4, 5 or 6) devices Data created/modified on iOS 15 (beta 4, 5 or 6) does not upload to iCloud (and eventually crashes the App)^ In order to see the iOS 14.7.1 -> iOS 15 (beta) changes appear I have to reload the app as the download seems to occur before the upload. Once the upload task 'starts' (it never really actually uploads anything), it prevents any changes from downloading. I've made no changes to my code, data model or NSPersistentCloudkitContainer related methods and it was something that abruptly appeared after installing iOS 15 beta 4. ^ basically any changes made on the device after iOS 15 (beta 4) was installed have not ever been sent to iCloud.
Replies
Boosts
Views
Activity
Aug ’21
SwiftUI TextField present integer (Int64) for macOS target
NumberFormatter does not function as expected under Xcode 13 betas or macOS 12 betas (currently up to beta 5 for both). I've logged feedback to Apple FB9423179. I'm writing a SwiftUI universal app with macOS and iOS targets using Core Data and NSPersistentCloudKitContainer. A Core Data Entity is an Observed Object in the code for a detail View. e.g. @ObservedObject var account: Account where Account is the class. NumberFormatter currently does not function in a TextField on macOS 12, so as a workaround I am currently using with great success: TextField(Sort Order, text: Binding( get: { String(account.sortOrder) }, set: { account.sortOrder = Int64($0.filter{0123456789.contains($0)})! } ) ) where sortOrder an entity attribute of type Optional. This works well for number entry and in my humble opinion is elegant in that it is immediately obvious what the TextField is expected to do to get the information it displays and set the information provided by the user. The only issue is that when the user makes
Replies
5
Boosts
0
Views
2k
Activity
Aug ’21
Reply to App getting killed by iOS while NSPersistentCloudKitContainer syncs
I'm facing a the same problem. In my case I'm collecting data in background mode. If internet connection gets lost, large amount of data might be sync when the device gets back on the internet. If data collection is still active, the background mode seems to keep NSPersistentCloudKitContainer alive resulting in the iCloud sync not being terminated and the app getting killed due to high CPU pressure. What framework are you using? I'm using SwiftUI. I'm also still looking for a solution.
Replies
Boosts
Views
Activity
Aug ’21
Reply to iOS 15 beta 4 CloudKit Auth Error
Everything appears fixed for me in Beta 5. I don’t use NSPersistentCloudkitContainer, just staight CloudKit calls. I wish Apple was more diligent in documenting this in release notes though. There’s nothing about this in Xcode or iOS beta release notes.
Replies
Boosts
Views
Activity
Aug ’21
Reply to iOS 15 beta 4 CloudKit Auth Error
This is NOT fixed with beta 5. Two problems related to NSPersistentCloudkitContainer persist since beta 4. I've submitted a bug report to Apple - no response yet. The issues: Account temporarily unavailable due to bad or missing auth token when using the Development Environment (device or simulator), despite being signed in and despite it working on beta 1, 2 & 3. When using the App Store version of my App (in the Production Environment) on an iOS 15 device (beta 4 & 5), the syncing appears to start but nothing syncs. The app crashes to the springboard after a minute without warning. Crash reports are vague but I have captured a CloudKit sysdiagnose and sent it to Apple in the hope they can decipher it. I really hope they sort this out as it's going to render my currently available app useless if iOS15 is released in this state and my users install it.
Replies
Boosts
Views
Activity
Aug ’21
Detect/Receive CloudKit CoreData Errors
In development I've switched to NSPersistentCloudKitContainer and have begun the terrifying process of trying to test as many scenarios as possible to make sure nobody loses any data. During some testing I saw an error like this: I was able to fix this, but it was only affecting some scenarios and if this had happened to a real user they (and I) would never have known about the problem, and their data would not have synced to CloudKit. If the store fails to load you get an error, but if it loads but doesn't sync you don't. So my question is: is there a way to receive these kind of errors in code? I have looked for notifications and delegate methods and I can't find any.
Replies
1
Boosts
0
Views
1.2k
Activity
Aug ’21
Reply to Is Core Data hosted in CloudKit working in Xcode 13?
Seems like a new issue in Beta 4 resulting in this error: Account Temporarily Unavailable (1028/2011); Account temporarily unavailable due to bad or missing auth token 'Reset All Contents & Settings' on the simulator doesn't appear to fix it this time. I've also noticed that the current App Store release version of my App which uses NSPersistentCloudKitContainer does not sync properly and crashes after 30 seconds. Nothing has changed other than installing Beta 4. I've submitted a bug report to Apple.
Replies
Boosts
Views
Activity
Jul ’21
How to clean up old NSPersistentStore files after migrating Core Data with CloudKit to App Group container
Hi, I’m trying to migrate Core Data with CloudKit to the shared App Group Container so that widgets can get access to it. So far, I’ve managed to do so with the following code: init() { container = NSPersistentCloudKitContainer(name: “AppName”) let storeDescription = container.persistentStoreDescriptions.first! // Clean up code goes here (explained later) // ... let sharedGroupStoreURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: group.com.XXX)!.appendingPathComponent(AppName.sqlite) storeDescription.url = sharedGroupStoreURL container.loadPersistentStores { (storeDescription, error) in if let error = error as NSError? { print(Unresolved error (error), (error.userInfo)) } } container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy container.viewContext.automaticallyMergesChangesFromParent = true } This tells Core Data to use the shared container. When the new persistentStore loads, it gets seamlessly populated with the data from CloudKit. So far, so good
Replies
1
Boosts
0
Views
705
Activity
Jul ’21
Is it safe to use a NSPersistentCloudKitContainer on a Share Extension?
I have an app that uses NSPersistentCloudKitContainer to store all the data so it's backed by iCloud and synced between devices. Such app has a Share Extension, that can be triggered both from iOS (and iPadOS) and macOS (Catalyst). I was wondering if it's safe to instantiate an NSPersistentCloudKitContainer from a Share Extension due to it being very short lived. At the moment, I'm sending the data straight to iCloud instead of instantiating an NSPersistentCloudKitContainer, but it feels wrong because I'm using the keys that NSPersistentCloudKitContainer created internally (CD_MyEntity, CD_myProperty, etc.) to send it to iCloud and then being correctly pulled by my clients. The only concern that I have is that bringing up an NSPersistentCloudKitContainer that has to pull data, might delay or even loose the data that I'm saving right now because it gets killed after some amount of time since the share action has been completed. Any insights will be much appreciated,
Replies
3
Boosts
0
Views
2.2k
Activity
Jul ’21
Add NSManagedObject to existing CKShare
Using NSPersistentCloudKitContainer, how do I add (or modify) the NSManageObjects that are part of a Share/Zone? I have initially created a CKShare using NSPersistentCloudKitContainer.share(_:to:completion:), how can I add objects to that share later on? Calling the method again (with to:existingShare filed), always seems to create a new Share. In fact, I don't understand what the to: parameter is for? It doesn't matter if I set it or not, a new CKShare is always created.
Replies
3
Boosts
0
Views
1.1k
Activity
Jul ’21
Reply to Manually define a CKRecord ID for a given NSManagedObject instance
hi, since you are using NSPersistentCloudKitContainer, you might want to take a look at Apple's page on Linking Data Between Two Core Data Stores. this provides a mechanism so that you can load up what i think you are calling base values in a local store, separate from the store that is mirrored to iCloud. this would solve the problem of loading base values on one machine, moving them into the cloud, and then trying to figure out on a second device how to prevent them from being reloaded from iCloud. hope that helps, DMG
Replies
Boosts
Views
Activity
Jul ’21
Reply to When I fetch records on CloudKit Console, it fails
I also have this issue. I'm using NSPersistentCloudKitContainer, is that something y'all are using too? Filed: FB9215275
Replies
Boosts
Views
Activity
Jun ’21
Reply to (Swift + CloudKit) or (SwiftUi + Core Data + CloudKit)
CoreData is definitely not falling off :-) Use SwiftUI+CoreData and sync with CloudKit, using either NSPersistentCloudKitContainer, an open-source sync engine like CloudCore, or a third-party sync engine like Ensembles.io
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’21
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