I have encountered an issue with a customer’s data access after they migrated to a different iCloud account, and I’m looking for guidance.
The Situation:
The customer was logged into their account on my app, which was associated with a specific iCloud account (iCloud A).
They had all their app data available while using iCloud A.
The customer then switched to a new iCloud account (iCloud B) on the same device, while still using the same app account.
After switching iCloud accounts, their data is no longer visible in the app or my CloudKit dashboard.
My Investigation:
I accessed the customer’s CloudKit data via the CloudKit Console, acting as their iCloud account.
I couldn’t find the private database zone or any of their records when accessing iCloud A through the console.
I don’t believe the data was deleted since actions performed under iCloud B shouldn’t affect data stored in iCloud A.
My Hypothesis:
I suspect that the customer’s old iCloud account (iCloud A) may have downgraded or stopped paying for iCloud storage.
If the iCloud subscription is inactive or expired, could that prevent me from accessing their CloudKit data?
Would renewing the iCloud subscription for iCloud A restore access to the missing data?
Questions:
Does an unpaid or expired iCloud account restrict access to CloudKit records, even if they weren’t deleted?
Would paying for iCloud storage again restore the data previously stored in CloudKit?
Is there any way to recover the customer’s CloudKit data if they are unable to access their old iCloud account?
If anyone has a simpler approach to recovering the customer’s iCloud-stored app data or has experience dealing with iCloud migrations like this, I’d appreciate your insights. Thank you in advance for any advice!
CloudKit Console
RSS for tagMonitor and manage the CloudKit database containers used by your apps.
Posts under CloudKit Console tag
26 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I am trying to port my application over to CloudKit. My app worked fine before, but then I made scheme of changes and am trying to deploy to a new container. For some reason, the database is not being created after I create the container through Xcode.
I think I have configured the app correctly and a container was created, but no records were deployed. My app current stores data locally on individual devices just fine but they don't sync with each other. That's why I would like to use CloudKit.
See screenshot from Xcode of where I have configured the container. I also have background notifications enabled. Also see screenshot from console where the container has been created, but no records have been.
Any suggestions would be greatly appreciated.
Thank you
Hi, I'm working on a macOS app that utilizes SwiftData to save some user generated content to their private databases.
It is not clear to me at which point the app I made starts using the production database. I assumed that if I produce a Release build that it will be using the prod db, but that doesn't seem to be the case.
I made the mistake of distributing my app to users before "going to prod" with CloudKit. So after I realized what I had done, I inspected my CloudKit dashboard and records and I found the following:
For my personal developer account the data is saved in the Developer database correctly and I can inspect it.
When I use the "Act as iCloud account" feature and use one of my other accounts to inspect the data, I notice that for the other user, the data is neither in the Development environment nor the Production environment. Which leads me to believe it is only stored locally on that user's machine, since the app does in fact work, it's just not syncing with other devices of the same user.
So, my question is: how do I "deploy to production"?
I know that there is a Deploy Schema Changes button in the CloudKit dashboard. At which point should I press that? If I press it now, before distributing a new version of my app, will that somehow "signal" the already running apps on user's machines to start using the Production database?
Is there a setting in Xcode that I need to check for my Release build, so that the app does in fact start using the production db?
Is there a way to detect in the code whether the app is using the Production database or not? It would be useful so I can write appropriate migration logic, since I don't want to loose existing data users already have saved locally.
I have integrated CloudKit into a CoreData application and am ready to deploy the schema to production but keep getting an "internal error" when trying to deploy to production or reset my CloudKit environment. I have attached images of what I am seeing including one of the console error. Is there any way to resolve this?
When attempting to deploy schema changes in the iCloudKit Database by clicking the Deploy Schema Changes button, a Confirm Deployment dialog appears, showing an error: “Internal error”. The following error details were observed in the JavaScript console:
• description: “The request has failed due to an error.”
• headers: undefined
• message: “Known response error: The request has failed due to an error.”
• result:
• code: 400
• detailedMessage: undefined
• message: “bad-request”
• reason: “Internal error”
• redirectUrl: undefined
• requestUuid: “0c5b4af2-15c9-425f-87ea-************”
• retryAfterSeconds: undefined
I really don't understand what kind of cyber crap CloudKit is!
In macOS, CloudKit basically doesn’t work properly
Hi everyone. I created test-apps years ago. Now I looked into https://icloud.developer.apple.com/dashboard/
There I found these old apps listed.
How do I delete these Apps in the Console and entirely from my account?
I don't have the project files anymore.
All the best! 😊
Looking at my CloudKit Telemetry console I noticed a significant increase in 'Other' errors recently. These errors are impacting user experience and I really don't know how to better understand the issues that may be occurring due to the "other" category. If I query the logs for "other" errors, only 2 results show up for the week. There are 2500+ errors in the telemetry graph (see attached).
Is anyone else experiencing this or does anyone have a suggestion on how I can better understand this issue? Thank you!
I previously got this error when I used a PassKey to log in. I'm not using that. I've put my password in multiple times, closed the browser, etc. It doesn't seem to be working. The only thing I can think is that because my Mac is using a different iCloud account, it's not letting me.
Does anyone have any ideas?
The same macOS app is logged into the same iCloud account on two Macs. The apps on both devices can sync data with iCloud, but the data between them is isolated. When I was developing, I just enabled the CloudKit(SwiftData host in iCloud) capability and did not do anything special. I thought that the same app and the same iCloud account should sync the same data between different devices. Why is the cloud data on these two Macs isolated?
I am getting the following error while trying to delete a Record Type in Dev container. How do I solve it?
invalid attempt to delete user record type
In CloudKit console, i have a key named "Name" with String data type and i want to filter my query by that key. I can only query two record with name "Star" and "Kaizen", and i can't query the rest of the records. Can you help me with that.
I created a new index on two record types on Oct 12th. I still cannot query the records using the new queryable index on records that were created before that date. There is no indication in the schema history that the reindexing has started, completed, failed, or still in progress.
What is the expectation for new indices being applied to existing records? Well over a week seems unacceptable for a database that has maybe 5000 records across a few record types.
When I query my data using an old index and an old record field, I get hundreds of matching results so I know the data is there.
FB15554144 - CloudKit / CloudKit Console: PRODUCTION ISSUE - Query against index created two weeks ago not returning all data as expected
Ive been getting this error on an app in the dev environment since iOS16. it continues to happen in the latest iOS release (iOS18).
After this error/warning, CoreData_CloudKit stops syncing and the only way to fix it is to delete the app from all devices, reset the CloudKit dev environment, reload the schema and reload all data. im afriad that if I ever go live and get this error in production there won't be a way to fix it given I cant go and reset the production CloudKit environment.
It doesn't happen straight away after launching my app in a predictable manner, it can take several weeks to happen.
Ive posted about this before here and haven't got a response. I also have a feedback assistant issue submitted in 2022 as part of ios16 beta that is still open: FB10392936 for a similar issue that caused the same error.
would like to submit a code level support query but it doest seem to have anything to do with my code - but rather the Apple core data CloudKit syncing mechanism.
anyone have any similar issues or a way forward?
> error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _requestAbortedNotInitialized:](2200): <NSCloudKitMirroringDelegate: 0x301e884b0> - Never successfully initialized and cannot execute request '<NSCloudKitMirroringImportRequest: 0x3006f5a90> D823EEE6-EFAE-4AF7-AFED-4C9BA708703B' due to error: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x73, 0x61, 0x6d)" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x73, 0x61, 0x6d)}
Anyone getting "Failed to execute query" when querying a Record type in CloudKit Console?
just a simple query on all records
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.
Hi All,
I used to be able to query all my records in dev for years. It seems today i have a bug where I can't query any of my records prior to 7/25/2024. I am able to query the older records using the record name but using the createdtimestamp or any other field i cannot access my records before 7/25/2024.
Anyone else having a similar issue?
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?
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.
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!