Posts

Post not yet marked as solved
3 Replies
Yes. It's right there in your posting title: the CloudKit public database. You can learn from any tutorials for CloudKit itself, skipping details relating to the private and shared databases.
Post not yet marked as solved
1 Replies
Did you ever resolve your issue? I too want to downsize an organization account to an individual one...
Post marked as solved
1 Replies
The table's dataSource is responsible for the table's data, so you could call the same code whether or not the CKRecord is nil, and when it's nil purge any existing data you had for the table, then refresh the table. Alternatively, that same code could hide/show the table and show/hide an alternate view (with a label that says "No records", for instance) when you have no records.
Post marked as solved
2 Replies
Development and Production use entirely different containers, so records added to one don't exist in the other. So it's not like Development vs. Production is a simple attribute—it represents deep differences in configuration.
Post not yet marked as solved
4 Replies
When you say "it doesn't work", can you clarify what exactly you're doing, what you're expecting to see, and what you are seeing instead? When Alice and Bob are sharing a record and Alice changes something in that share, Bob will only see the change automatically if there's a subscription set up for it. If you are expecting a notification about the change, and you're seeing it work in Development but not in Production, verify that you have in fact established a subscription in Production. If, on the other hand, you are attempting to fetch a shared record with what should be a reliable recordID and this works in Development but not in Production, then it might be something else.
Post not yet marked as solved
4 Replies
Perhaps you didn't set up subscriptions in Production? You might have set them up in Development, then neglected to do in Production as well.
Post not yet marked as solved
3 Replies
Supply a perRecordSaveBlock and perRecordDeleteBlock within that operation and maintain the cumulative results there, leaving the modifyRecordsResultBlock free to describe the operation as a whole.
Post not yet marked as solved
1 Replies
I've determined that the icons/avatars are indeed available, but through ContactsKit rather than CloudKit. The images shown are all images you have personally associated with the user's Contact entry in your Contacts app. How to retrieve the images: let share = mySharedRecord.share let participants = share.participants let userIdentities = participants.map {$0.userIdentity} let emails = userIdentities.compactMap {$0.lookupInfo?.emailAddress} let store = CNContactStore() let keysToFetch = [CNContactImageDataAvailableKey, CNContactImageDataKey, CNContactThumbnailImageDataKey] as [CNKeyDescriptor] emails.forEach { email in do { let predicate = CNContact.predicateForContacts(matchingEmailAddress: email) let contacts = try store.unifiedContacts(matching: predicate, keysToFetch: keysToFetch) let imageDatas: [Data] = contacts.compactMap {$0.imageData} let images = imageDatas.map {UIImage(data: $0)} return images } catch { // Handle the error return nil } }
Post not yet marked as solved
1 Replies
The following is an opinion. Informed, but still an opinion. 1a. If your app's core functionality requires iCloud and the user is not signed into iCloud, display a clear message telling the user that they'll need to sign in to iCloud to use your app and include a button to take them to the system page for signing in. Do not simply display an alert, but rather show it in an attractive, polite, and modeless/full-window presentation. 1b. If your app includes a non-essential feature that requires iCloud and the user is not signed into iCloud, display a modeless notification/affordance to indicate that the feature is inactive and will remain so until they sign into iCloud. The notification might take the form of a special icon positioned where that feature is normally accessed. Tapping that icon (or hovering, on a Mac) might pop up a brief explainer. If the feature's importance warrants it, a more prominent notification might be used. Modeless is better than modal. Sync should be automatic. Users will expect this if they use your app across multiple devices. Making it automatic may also clarify what you choose to sync. User data should certainly sync, but user settings may not. If I set my background color to blue to match my blue iPhone, I might not appreciate that my silver iPad's background color is now blue as well. Resist the temptation to ask the user whether they'd like to sync this or that. Rather, make that determination yourself after carefully considering the value to the user. Also, if possible give the user a way to initiate a manual sync—it's reassuring—and display an indicator like a green checkmark to indicate that the sync completed successfully or failed. One common way to provide a manual sync is by including a pull-to-refresh on the scrollview containing the user's content.
Post not yet marked as solved
1 Replies
Replied In New Database
When you configure your app to use CloudKit, 3 databases are created for you automatically: public, private, and shared. You don't create them yourself. You'll need to read the documentation for a full understanding, but a good place to start is https://developer.apple.com/documentation/cloudkit/designing_and_creating_a_cloudkit_database.
Post not yet marked as solved
2 Replies
You'll find it in CKContainer.containerIdentifier.
Post not yet marked as solved
3 Replies
I should add that I'm trying to understand how this works independently of the sharing controller. I appreciate that the sharing controller offers a "Stop Sharing" button for the owner and a "Remove Me" button for the joined participant. I was wondering about the programmatic approach.
Post not yet marked as solved
5 Replies
There's nothing of interest in the code, but I did confirm that the operation was indeed enqueued to the private database, though, as you say, it should have been enqueued to the shared database. So, my error!
Post not yet marked as solved
5 Replies
More info. A follow-on error reports that "PrivateDB can't be used to access another user's zone" so I'm guessing that subscriber B is attempting to save to owner A's private database instead of subscriber B's shared database. Still investigating...