Post

Replies

Boosts

Views

Activity

Reply to Using Core Data objects with Transferable
I didn't know about this till I read your post Based on the documentation, it looks like Item needs to be transferrable struct CKShareTransferRepresentation<Item> where Item : Transferable I am not sure how it fits in with CloudKit Sharing, CloudKit sharing already exists without transferable, may be it would be transformed, I am not sure CloudKit Sharing (without using transferable) - https://developer.apple.com/documentation/cloudkit/shared_records/sharing_cloudkit_data_with_other_icloud_users
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to Are CKRecords Guaranteed to be Added to an NSPersistentCloudKitContainer Store in creationDate order?
My understanding of your problem (could be wrong): You have a share extension and you have a parent Mac app. When you share data using the extension, the data gets duplicated Questions Where are you storing the data (which entity) when data is share extension? My approach (could be wrong) Share Extension should write to a separate entity that is not synced to iCloud Then sync the data from your share extension entity to your original entity You would have hooked your original entity to sync to iCloud so that should automatically take of syncing Steps Add a new configuration called ShareExt (example name) to your CoreData data model (xcdatamodeld file ) Add a new entity called MyEntity (example name) Add MyEntity to ShareExt configuration To persistentStoreDescriptions and add ShareExt (refer https://developer.apple.com/wwdc19/202) Sync from your MyEntity to your OriginalEntity (which you are using in the app) - refer https://developer.apple.com/documentation/coredata/linking_data_between_two_core_data_stores Reference Using CoreData with CloudKit Consuming Relevant Store Changes Linking Data Between Two Core Data Stores
Aug ’22
Reply to NavigationStack and NavigationSplitView Runtime warnings
Xcode 14.0 beta 5 (14A5294e) seem to have fixed my issues with NavigationSplitView Fixed - Warnings Fixed - Selection of cell not happening (2nd time) in compact mode (For 3 column layout) - so no need to set the selected state of the middle column to nil onDisappear Hopefully it has fixed your issues as well, if not please file a feedback
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to CloudKit, core data: "Failed to sync user keys" after Xcode update to 13.4.1
Use real device, and now you don't have to use your developer account (iCloud) on your real device, you could use your personal iCloud account. On CloudKit Dashboard there is a new option called "Act as iCloud Account" which can be used into your personal account Then you can debug and see your private database records for your personal account. If you don't have more than 1 device you could a build a simple UI (swiftUI), use your Mac as your other device
Aug ’22
Reply to CoreData+CloudKit custom Zone
Are you using manually syncing your CloudKit with CoreData or are you using NSPersistentCloudKitContainer? If you using NSPersistentCloudKitContainer does the syncing for you, don't have to set any custom zone, it would set a custom zone automatically. If you are doing it manually, then you would need to set a custom zone when you are saving a record and when you are retrieving it not while loading the container's persistent stores (which is what you are doing).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to CloudKit Design
If you want something accessible only to the individual use Private database, Public database is common to all users. Example: Restaurant Menu data can be in the Public database, food items ordered should be stored in Private database. So only the individual can view his ordered items. Refer to https://developer.apple.com/icloud/cloudkit/designing/.
Aug ’22
Reply to CloudKit Public Database
Go to Developer App (available for Mac, iOS) and search for CloudKit Shar (you will find a lot of content) https://developer.apple.com/videos/play/tech-talks/10874 https://developer.apple.com/wwdc21/10015 Sample projects https://github.com/apple?q=cloudkit-sample&type=repository%E2%80%9D
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to Error: Failed to sync user keys in simulator
Problem 1: NSPersistentCloudKitContainer doesn't seem to work on simulator Solution: Use device, haven't found a way to make it work on the simulator. Problem2 When using CloudKit APIs (not NSPersistentCloudKitContainer) on the simulator I was getting CKError.notAuthenticated even though I had signed into iCloud on the simulator Root cause This happens when 2FA was enabled on the iCloud account but the 2FA code was asked on the simulator Solution Go to https://appleid.apple.com/, select devices on the sidebar Remove simulator (I found 2 simulators, removed both) Reset Xcode simulator Log into iCloud on the simulator Run the app Hopefully that should work.
Aug ’22
Reply to Prevent CloudKit sync / trigger sync manually
Short term approaches 1. User to turn off iCloud manually The user of the app can turn off iCloud for the App by doing the following on iOS: Settings > iCloud > YourAppName You will see a toggle switch to turn off iCloud usage for the app Every user will have to do that by himself / herself manually 2. CloudKit Dashboard (turn off visibility) Warning: Please test using a dummy container before you turn off your real container's visibility Go to CloudKit Dashboard Tap on the container name, a drop down would show up Tap on Manage Containers Warning: Please test using another container before turning off visibility on the real production container Long term approaches In the long term, you could try one of the following which ever suits you best 1. Separate Entity that doesn't sync automatically On your CoreData Model, create a separate configuration and add an entity to that configuration. Do all your saving into the new entity (which doesn't sync automatically), when you are ready move it to another entity which uses the default configuration which would sync. You need to make changes to your store descriptions and new store description for that new configuration. Refer: https://developer.apple.com/wwdc19/202 2. Don't save view context directly, instead use a child context (not 100% sure) If you save the viewContext, it would save to file and would trigger a sync, instead create a child context to the view context and save it in the child context That way your views will reflect the change but it is not saved to disk, but you need to save it before app quits or leaves a view so that user doesn't loose the data. 3. Change your logic and see how you group records and then save together
Aug ’22