Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Initialising CloudKit schema on public database fails for in Core Data with multiple strings (rdar://FB8995024)
Hi all, I'm trying to use NSPersistentCloudKitContainer.initializeCloudKitSchema() to initialise a public CloudKit database, but it seems to fail when any given entity has more than two String fields (or, it seems, any two fields which NSPersistentCloudKitContainer decides need to be CKAsset-backed). I've raised rdar://FB8995024 about this too, but was wondering if someone here can see something I'm missing. I can consistently reproduce this on iOS 14.4 (18D46) on the iOS Simulator with Xcode 12.4 (12D4e), or with an iPhone 11 Pro running iOS 14.4 (18D52) using this code (in a new iOS App project, SwiftUI/SwiftUI App/Swift, Use Core Data+Host in CloudKit) and a single Core Data entity with two String attributes: import CoreData import SwiftUI @main struct NSPersistentCloudKitContainer_initTestingApp: App { let persistenceController = PersistenceController.shared var body: some Scene { WindowGroup { Text(Success) } } } struct PersistenceController { static let shared = PersistenceController() let cont
4
0
3.0k
Sep ’21
Reply to App getting killed by iOS while NSPersistentCloudKitContainer syncs
Have you received any update from Apple on this? They have not replied to my Feedback report at all - not even acknowledged the receipt of my test data, or if it might even be something I’ve done wrong. Nothing. We’re about a month away from release and this is going to break my app if not fixed - which has been working fine for the past 2 years using NSPersistentCloudKitContainer. I suspect there will be a lot of developers & users that will be caught off-guard if it’s released to the public as it’s only a ‘visible’ problem for those of us with slightly complex Core Data models. My app is a medical record keeping app and my users are going to be extremely angry when it fails to sync after they upgrade to iOS15 if this isn’t fixed. In my line of work (I’m an MD) this poor (or no) communication would see me sued by my patients (and quite rightly too) - people just need to know something is being done. Something fundamentally changed with NSPersistentCloudKitContainer from beta 4 and this
Sep ’21
Reply to NSPersistentCloudKitContainer - Import failed because applying the accumulated changes hit an unhandled exception
This won’t answer your question, sorry… but it might be related to the problem several of us are having with NSPersistentCloudKitContainer - it seemed to appear with beta 4 and is still present with beta 7. Something fundamental was modified in beta 4 and sure hope it’s fixed before release otherwise I’m in real trouble (from my users!). See here for my thread on the issue.
Aug ’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
1
0
850
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
2.0k
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
691
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.1k
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
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