Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Reply to databaseScope lead to dyld: Library not loaded on xcode13-beta with simulator 14.5
Not an answer I’m afraid, but perhaps a related problem. They’ve definitely changed something deep at the OS level which is even affecting the CloudKit syncing of apps built with the iOS 14 SDK many months ago (ie. my app!) if run on an iOS 15 device, let alone apps built with the iOS 15 SDK! This failure of syncing started to occur when iOS 15 beta 4 was released - prior to this it was all working normally, as it did in iOS 13 & iOS 14. From beta 4 the entire structure of the console log outputs for NSPersistentCloudKitContainer changed, so something fundamental changed with CloudKit at this time. In my case, it seems it has trouble syncing Core Data relationships and NSPersistentCloudKitMirrorringDelegate gets stuck in a loop causing CPU & RAM consumption to rise uncontrollably, with the OS killing the app shortly afterwards. No syncing occurs. My Core Data structure has not changed since iOS 14 and my app synced (and still does) just fine on iOS 14 devices. Other than a reply from a ‘Frame
Sep ’21
Reply to NSPersistentCloudKitContainer Bug
I wanted to follow up on this statement in my first post for any other readers: the root NSManagedObject's record is not being updated with the relationship linkage to the shared record. I figured out later that this is because there are 2 different ways to do shares: you share Records or Zones. The new share functionality in NSPersistentCloudKitContainer appears to be creating full Zone shares unlike the code documented on CKShare. When the Zone share is made there are no relationships created on the records in the zone because they are all made available to the Participants. In terms of the bug with local ckshare being updated, that is still an issue. I haven't tested the suggestion by Fat Xu yet and in the meantime I had to query CloudKit directly (not thru NSPersistentCloudKitContainer) for the most recent ckshare records.
Sep ’21
Reply to NSPersistentCloudkitContainer Memory Leak -> Crash? (iOS 15 beta 4 & 5)
Sorry, Apple... this is still broken in iOS 15.1 (beta 2) The CPU & RAM usage is still excessive and no syncing occurs at all. I've replied to my TSI in the hope I can get someone to look into this as a matter of urgency. I now have users running iOS 15 who are no longer seeing their data syncing via iCloud, resulting in a terrible user experience, using my app downloaded from the App Store which has been unchanged since iOS 14. Whatever Apple did in iOS 15 beta 4 to NSPersistentCloudKitContainer, they broke it badly. Maybe users who don't have complex databases aren't seeing this problem, but the whole point of NSPersistentCloudKitContainer is to sync a Core Data store with complex relationships (and besides, it works just fine on iOS 13 & iOS 14!). My testing setup Monterey (beta 8) Xcode 13 (13A233) non-beta Testing on iPhone 13 Pro with iOS 15.1 (beta 2) Preparation Deleted iCloud data for my app Deleted my app from the device (App Store download) Rebooted device Reset the iCloud
Sep ’21
Reply to NSPersistentCloudkitContainer Memory Leak -> Crash? (iOS 15 beta 4 & 5)
This is all very confusing to me... ...and it's quite possible that this 'bug' is something I'm doing wrong when ingesting data from a backup file, despite it all appearing to save to Core Data just fine. But why now though? Why has it been working just fine for almost 2 years without modification? Backup Restore Process The backup file that my users create is a serialised dictionary file, which includes encoded data for images (if present). When I restore it, I use a private context to ingest it on a background thread, with a progress bar being updated on the main thread. As I do not want partially imported data to be incorporated into the user's Core Data store I only save the context at the end of the import when successful. This has been working flawlessly for the past 2 years with NSPersistentCloudKitContainer, with the data syncing after the import finishes and is saved to Core Data... but was it only working by accident all this time!? Should I not be using the private context to save imported
Sep ’21
How to deduplicate entities with relationships in NSPersistentCloudKitContainer?
In my app I have a defaultJournal: Journal, that automatically gets added on the user's device on launch. There should only be one default journal, and I know that deduplication as shown in the Apple Demo, is the correct approach to ensure this on multiple devices. Journal looks something like: class Journal: NSManagedObject { @NSManaged var isDefaultJournal: Bool @NSManaged var entries: Set? } Since Journal has a relationship to entries, how can I deduplicate it ensuring that I don't orphan or delete the entries? I am worried that the entries aren't guaranteed to be synced, when we discover a duplicate journal in processPersistentHistory. This would lead to either orphaned or deleted entries depending on the deletion rule. How can one handle deduplicating entities with relationships? For example here is my remove function: func remove(duplicateDefaultCalendarNotes: [Journal], winner: Journal, on context: NSManagedObjectContext) { duplicateDefaultCalendarNotes.forEach { journal in defer { context.delete(journ
1
0
1.2k
Oct ’21
Cannot see records in the iCloud Production environment
I'm attempting to use Core Data + CloudKit to persist user's data with the NSPersistentCloudKitContainer class. I'm able to see created records in the Development environment but records won't show in the Production environment. With just this brief description, what could be the issue? Notes I have deployed the schema to the Production environment. I'm using the same device and iCloud account for both environments My Apple ID is the same for my personal and dev account. I'm attempting to add records to Production via a TestFlight build The iCloud toggle for the app is ON. What are some initial thoughts as to why there is a sync issue?
0
0
507
Oct ’21
CloudKit initial sync and background audio leads to high CPU app termination
I have a music app that can play in the background, using AVQueuePlayer. I'm in the process of adding support for CloudKit sync of the CoreData store, switching from NSPersistentContainer to NSPersistentCloudKitContainer. The initial sync can be fairly large (10,000+ records), depending on how much the user has used the app. The issue I'm seeing is this: ✅ When the app is in the foreground, CloudKit sync uses a lot of CPU, nearly 100% for a long time (this is expected during the initial sync). ✅ If I AM NOT playing music, when I put the app in the background, CloudKit sync eventually stops syncing until I bring the app to the foreground again (this is also expected). ❌ If I AM playing music, when I put the app in the background, CloudKit never stops syncing, which leads the system to terminate the app after a certain amount of time due to high CPU usage. Is there any way to pause the CloudKit sync when the app is in the background or is there any way to mitigate this?
3
0
2.6k
Oct ’21
Coredata and CloudKit not synchronized
1/ Signing & capabilities background mode - > remote notification cloud -> cloudkit @ container created 2/ coredata ->used with cloudkit & all attributes are optionals 3/ appDelegate NSPersistentCloudKitContainer viewContext.automaticallyMergesChangesFromParent = true AND it's not working on my two devices (iPhone & iPad) under iOs 15.0.2 What did I forget?
2
0
861
Oct ’21
Core Data Sharing with iCloud Drive Files
I have an app for client management that stores data in Core Data with an NSPersistentCloudKitContainer. Each manager have their clients in the Core Data Private Database, and each client could have associated files (images, documents, etc) that are stored in app's own folder structure in iCloud Drive. Eventually, a manager can decide if to share a client with another manager, in order to have a shared managed client (readable, or writable+readable by others managers which share the same client). This is done by moving the Client from the Private Database to the Shared Database following the Apple's guidelines: https://developer.apple.com/videos/play/wwdc2021/10015/ This is the structure: The problem is: the database record is shared correctly, but the iCloud Drive Files are not shared (obviously). My goal is to get working the iCloud Drive Client Files (every client has a single Folder) with the minimum effort from the user. I cannot get working the iCloud Drive Sharing from my app, only the Core Da
0
0
901
Oct ’21
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
100% CPU, Energy Efficiency NSPersistentCloudKitContainer / Best Practices?
Hi, I recently added iCloud sync capability to my app via NSPersistentCloudKitContainer. It does push data to the cloud, in other words seems to be working fine. However, I noticed a strong increase in battery drain and when I debug (release and debug build configs) I can see that a NSManagedObjectContext thread that is definitely not mine has 100% CPU load basically all the time. (I waited a few minutes, yes minutes, for it to finish while not using the app at all and it does not stop.) Component utilization shows that most the energy impact is CPU and overhead is very low (goes to 0 quickly). There is no network activity visible, so this seems to be some kind of background processing. Also, memory is very, very low (~ 35 MB). I am wondering if I am doing something wrong here or if there is a better practice. Some info about how my app works: It downloads things from the web and generates a lot of entities while doing so. It frequently saves changes (incremental changes in entities, there are lots o
0
0
943
Nov ’21
Data Collection
Hi everyone, I am very new to SwiftUi and am not sure about data collection to disclose. Does using the sign in with Apple feature and Core Data with CloudKit count as Data Collection? (if it does what would it come under) I use @AppStorage for the sign in and not the UserDeafult feature. For CloudKit I only use the inbuilt NSPersistentCloudKitContainer container and for saving the generic: viewContext.automaticallyMergesChangesFromParent = true viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy Thank you
0
0
358
Nov ’21
Reply to Why does CloudKit data field (bytes) take up more (~10 times) iCloud storage than asset field?
@DD21 Did you end up finding a solution? I'm using NSPersistentCloudKitContainer to have CloudKit + Core Data and I'm observing the same issue. I have saved ~6000K items in Core Data, which some of them have images. The local size for the sum of the images is around 76 MB, but if you check it on iPhone > Settings > Apple ID > iCloud > Manage Storage, it shows up as ~760 MB, which is the 10x increase in size that you reported a year ago. This seems to be a bug on the whatever's in charge of calculating the size for iCloud assets, because when I delete my app from my device and let it download all the information stored on iCloud again, it finishes the download extremely fast (I'm assuming because it's only downloading 76MB). If it were downloading 760MB, it would take much longer knowing my network connection speed. Now, if this bug actually affects user's iCloud quota (which it seems that it does), it is a large scale issue that might be impacting millions of users. Users might have much
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’21
@SectionedFetchRequest with hierarchical data structure (maybe OutlineGroup?)
I am working on a couple of Multiplatform apps that use a very similar 3 column layout - sidebar menu (or tabs for sizeClassHorizontal == .compact), with a master list under each menu option and detail view based upon master list selection. The apps use Core Data framework and NSPersistentCloudKitContainer for backup and syncing across a user's devices. The apps use Codegen = Class Definition and I write extensions for each entity to prepare convenience methods, properties, comply with generic protocol conformance. I am learning how to retrofit sectioned fetch requests into each master List. Generally this is straightforward and I'm really happy with the result. However, one particular master list is based upon an hierarchical data structure and I have investigated using the children: parameter in List to successfully create an hierarchical list. So to be clear, the following code is based upon @FetchRequest var gardens: FetchedResults (not a sectioned fetch request) and works well... extension Garde
3
0
2.2k
Nov ’21