CloudKit Console

RSS for tag

Monitor and manage the CloudKit database containers used by your apps.

Posts under CloudKit Console tag

14 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

CloudKit Integration Issue: Record Type Not Found
Hello everyone, I'm working on an iOS app that uses CloudKit for data synchronization. I'm encountering an issue where my app can't find the "JournalPrompt" record type in the public database. Here's the relevant code and error messages (I'm using placeholders like [APP_NAME] or [CONTAINER_IDENTIFIER]): private func fetchPromptsFromiCloud() { let container = CKContainer(identifier: "[CONTAINER_IDENTIFIER]") let publicDatabase = container.publicCloudDatabase // Create a predicate to query for the specific record let predicate = NSPredicate(format: "recordID.recordName == %@", "B6663053-FC2E-4645-938B-9FA528D59663") let query = CKQuery(recordType: "JournalPrompt", predicate: predicate) publicDatabase.perform(query, inZoneWith: nil) { [weak self] (records, error) in if let error = error as? CKError { if error.code == .unknownItem { print("JournalPrompt record type does not exist or the specific record was not found in the public database.") } else { print("Error fetching record from iCloud public database: \(error)") } return } guard let record = records?.first else { print("No record found with the specified ID in the public database.") return } print("Found record in public database:") print("Record ID: \(record.recordID.recordName)") print("Text: \(record["text"] as? String ?? "No text")") print("Creation Date: \(record.creationDate ?? Date())") print("Used Count: \(record["usedCount"] as? Int ?? 0)") print("Is Default: \(record["isDefault"] as? Bool ?? false)") } } Error When I run this code, I get the following error: Error fetching record from iCloud public database: <CKError 0x600000c072a0: "Invalid Arguments" (12/1009); "Invalid predicate: recordKey (recordID.recordName) contains invalid characters"> I've also implemented a function to check the CloudKit schema: func checkCloudKitSchema() { checkDatabase(scope: .private) checkDatabase(scope: .public) } private func checkDatabase(scope: CKDatabase.Scope) { let container = CKContainer(identifier: "[CONTAINER_IDENTIFIER]") let database = scope == .private ? container.privateCloudDatabase : container.publicCloudDatabase print("Checking \(scope == .private ? "private" : "public") database") database.fetchAllRecordZones { (zones, error) in if let error = error { print("Error fetching record zones: \(error)") return } print("Available record zones in \(scope == .private ? "private" : "public") database:") zones?.forEach { zone in print("- \(zone.zoneID.zoneName)") } let query = CKQuery(recordType: "JournalPrompt", predicate: NSPredicate(value: true)) database.perform(query, inZoneWith: nil) { (records, error) in if let error = error as? CKError, error.code == .unknownItem { print("JournalPrompt record type does not exist in the \(scope == .private ? "private" : "public") database.") } else if let error = error { print("Error fetching records from \(scope == .private ? "private" : "public") database: \(error)") } else if let records = records, !records.isEmpty { print("JournalPrompt record type exists in the \(scope == .private ? "private" : "public") database.") print("Fetched \(records.count) JournalPrompt records:") for record in records { print("Record ID: \(record.recordID.recordName)") print("Fields:") record.allKeys().forEach { key in print(" - \(key): \(type(of: record[key]))") } print("---") } } else { print("JournalPrompt record type exists in the \(scope == .private ? "private" : "public") database, but no records found.") } } } } When I run this, I get: Checking public database Available record zones in public database: _defaultZone JournalPrompt record type does not exist in the public database. CloudKit Database Setup I've set up my CloudKit Database as follows: And my data model is as follows: Despite this setup, my app can't seem to find or interact with the JournalPrompt record type. I've double-checked that my app's identifier matches the one in the CloudKit dashboard, and I've verified that the record type name is spelled correctly. Questions: Why might my app be unable to find the JournalPrompt record type, even though it's defined in the CloudKit dashboard? Is there anything wrong with my query or error handling that could be causing this issue? Are there any common pitfalls or setup steps I might have missed when integrating CloudKit? Any insights or suggestions would be greatly appreciated. I really appreciate any help you can provide.
2
0
112
1w
Zombie CKQuerySubscription
I am converting my subscriptions to shouldBadge=NO; and adding silent notifications to implement my own badge count incrementation now that setApplicationIconBadgeNumber: doesn't work. (see [https://stackoverflow.com/questions/47542005/ckmodifybadgeoperation-is-deprecated-in-ios-11-anyone-know-an-alternative-appro] The problem is that I still have subscriptions with shouldBadge=YES; triggering. I cannot delete those subscriptions because they do not appear in a fetchAllSubscriptionsWithCompletionHandler: . I think I may have deleted the subscriptions from the Development and Production environments on the dashboard and that is why they do not appear in the fetch. But they still exist and are firing over and over again - and setting the badge. Does anyone know how to delete a subscription that can't be fetched?
1
0
207
3w
"Internal Error" in CloudKit Dashboard
Hi, I'm getting an "Internal Error" in the CloudKit Dashboard for my user. This happens for the Private database across all of my apps, and in both Development and Production environments. (Screenshot attached). If I login as a different user via the 'Act as iCloud Account' function, everything works fine - it seems to be an issue with my own user account. In the JavaScript console, I see "Known response error: The request has failed due to an error.", but no other details (Screenshot attached) I can see these failures in the Logs tag, showing as 'INTERNAL_ERROR' (another Screenshot) It appears that the data on my account is currently not sync'ing to CloudKit, although I haven't found any other errors from within the app claiming that there is an issue (using the CoreData+CloudKit integration). I'm assuming my in-app errors and my dashboard errors are related, although it's difficult to say without more information on what these errors actually are.
4
0
269
Aug ’24
Adding indexes more difficult with updated cloudkit console
Can the cloudkit console team please look into managing indexes with their updated cloudkit console tool? Working with Record indexes used to be straightforward but it has now become cumbersome and unintuitive. For example, why does the tool force you to fill in some name field if adding a queryable index for recordName? Why can't you create several index types at once for a given field? It is possible to manage schemas in some other ways but for small changes the console used to be handy. It's now become a pain. Thanks!
0
1
291
Jul ’24
Deleting CloudKit data
I have been testing an app which uses cloudKit with SWIFTDATA and after testing for several months my 200GB iCloud store is showing 168GB for iCloud Drive. Now my iCloud drive is only 22.6GB so the rest of the 168GB must be data from my app. Also, I have function in my app to delete all iCloud Data which I thought that should clean up iCloud storage but it does not. I tried resetting the Develop Environment but no change to iCloud data. Also I have several other containers in iCloud created while getting iCloud working which I would like to delete but I understand you can’t. https://forums.developer.apple.com/forums/thread/45251?answerId=788694022#788694022 Bottom line cloudkit console has been pretty much useless for me and I need a way to manage (delete containers and data). Am I missing something?
1
0
400
Jun ’24
CloudKit database - 500 Internal error
As of yesterday all queries my app makes to the CloudKit database, and requests via the CloudKit console result in 500 internal errors. We have made no changes to the database or app that could have caused this. The status page for CloudKit database is green. Here is a response from the CloudKit console: {code: 500, message: "internal-error", reason: "Internal error", detailedMessage: undefined, requestUuid: "808955a2-e564-459e-ba9b-1101917ce1a4"}
1
0
422
May ’24
ios push notification not received after getting out of airplane mode
I'm sending a push notification using Noticed Gem during the night when my phone is in airplane mode. When I wake up and disable the airplane mode, I don't get the push notification. These are the settings: ` def ios_format(apn) apn.custom_payload = { universal_link: url } apn.alert = { title: title(recipient), body: message(recipient) } apn.sound = 'default' apn.priority = '10' # Send immediately, bypassing the end ` default expiration is supposed to be 30 days. How can I debug/fix the problem? (with noticed gem) I checked Apple consoleKIT, and I don't see discarded notifications. Thanks
3
0
653
May ’24
Unable to access CloudKit Database containers
Hello, We have a problem and we don't know how to solve it. Our application uses CloudKit databases. We can no longer access the CloudKit databases. When we connect to the CloudKit console and select CloudKit Database, we get the message "No Containers". However, the application continues to work by downloading files located on CloudKit Database. How can I modify CloudKit Database data?
0
0
461
Feb ’24
CloudKit Console - Internal Error during Query Records
Issue: I'm experiencing intermittent CloudKit Console 'Internal Error' when performing simple queries on a Private database. I am experiencing this issue with multiple CloudKit databases. In all instances, the issue is intermittent. Steps to Replicate in the CloudKit Console: Select a Database Select Records Select Private Database Select Custom Zone Select Record Type Select Query Records IF the records populate, click 'Query Records' again until Internal Error occurs. Expected Results: A list of records Actual Results: 'Internal Error' (see screenshot below) Additional Info: Starting last month, I started receiving CKCloudKit Error 15 when attempting to sync data from a private CloudKit database. My query code has not changed for a few years now with no previous issues. I believe these errors are the 'same' and on the Apple Server side. Is anyone else experiencing this issue? Any help would be greatly appreciated. Thank you.
3
2
914
Dec ’23