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
CloudKit Dashboard
RSS for tagMonitor and manage the CloudKit database containers used by your apps.
Posts under CloudKit Dashboard tag
29 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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)}
Every new container i create for cloudkit doesn't work and or connect back to my icloud dev account. Here are the errors:
Communication with Apple failed.
An iCloud Container with Identifier 'iCloud.icloud.com.plantclock.backup' is not available. Please enter a different string.
Provisioning profile "iOS Team Provisioning Profile: CGL.CannaGrowLog" doesn't support the iCloud.icloud.com.plantclock.backup iCloud Container.
Provisioning profile "iOS Team Provisioning Profile: CGL.CannaGrowLog" doesn't match the entitlements file's value for the com.apple.developer.icloud-container-identifiers entitlement.
STEPS TO REPRODUCE
Went into xcode > Project name > targets > icloud > containers > + sign and anytime i try to add it fails with the above issues.
Also, going into apple dev website has no option to even see or add containers.
Hello everyone,
I’ve recently encountered an issue where my app is working perfectly fine, but I’m seeing an “OTHER” error in the CloudKit dashboard under errors. I’ve checked the logs and there doesn’t seem to be any obvious failure or issue affecting the app’s functionality.
The error doesn’t provide much detail, and I’m having trouble identifying the root cause since everything appears to be functioning as expected in the app. Has anyone else experienced this? Is this something that could be related to a server-side issue, or am I missing something on my end?
Any insights or advice would be greatly appreciated!
Thanks in advance!
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.
Is it ok to have latency about 4 sec? The amount of downloaded data is less than 1 MB. Maybe I need to setup an index for every field requested?
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.
Hello everyone,
I'm currently working on an iOS app using SwiftUI and Core Data, integrating CloudKit for data synchronization. I've set up my Core Data stack with NSPersistentCloudKitContainer, and everything appears to be working correctly locally. However, I'm not seeing any records appearing in the CloudKit Dashboard. This issue started occurring after transferring the Apple Developer account ownership and changing the CloudKit container.
Here's a summary of my setup and what I've tried so far:
Setup
PersistenceController.swift
import SwiftUI
import Foundation
import CoreData
import CloudKit
class PersistenceController {
static let shared = PersistenceController()
let container: NSPersistentCloudKitContainer
init() {
container = NSPersistentCloudKitContainer(name: "Model")
guard let description = container.persistentStoreDescriptions.first else {
fatalError("No Descriptions found")
}
description.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.com.company.Project")
container.loadPersistentStores { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}
container.viewContext.automaticallyMergesChangesFromParent = true
}
func saveContext() {
let context = container.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
static let preview: PersistenceController = {
let controller = PersistenceController()
// Remove existing preview data
let fetchRequest: NSFetchRequest<NSFetchRequestResult> = Letter.fetchRequest()
let batchDeleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest)
let userFetchRequest: NSFetchRequest<NSFetchRequestResult> = User.fetchRequest()
let userBatchDeleteRequest = NSBatchDeleteRequest(fetchRequest: userFetchRequest)
let senderFetchRequest: NSFetchRequest<NSFetchRequestResult> = Sender.fetchRequest()
let senderBatchDeleteRequest = NSBatchDeleteRequest(fetchRequest: senderFetchRequest)
do {
try controller.container.viewContext.execute(batchDeleteRequest)
try controller.container.viewContext.execute(userBatchDeleteRequest)
try controller.container.viewContext.execute(senderBatchDeleteRequest)
try controller.container.viewContext.save()
} catch {
fatalError("Failed to delete preview data: \(error)")
}
}
Entitlements.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.company.Project</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudKit</string>
</array>
</dict>
</plist>
What I've Tried
Verified that the iCloud capability is enabled in the Xcode project settings.
Checked the containerIdentifier in the NSPersistentCloudKitContainer setup.
Ensured the app is signed in with the correct iCloud account.
Observed that local Core Data operations work correctly and save without errors.
Waited to ensure any potential synchronization delays are accounted for.
Observations
I see debug messages in the Xcode console indicating that records are being serialized and saved to CloudKit, but they do not appear in the CloudKit Dashboard.
I have verified that I'm looking at the correct Private Database and _defaultZone.
When I delete the app and reinstall it, I can see that the data remains, indicating that the data is being stored somewhere in iCloud but not visible in the CloudKit Dashboard.
After resetting the schema in the CloudKit Console and running the app, the schema (including record types) syncs immediately, but the records are still not visible.
Console Output
CoreData: debug: CoreData+CloudKit: -[PFCloudKitSerializer newCKRecordsFromObject:fullyMaterializeRecords:includeRelationships:error:](576): Serializer has finished creating record: <CKRecord: 0x15b13e600; recordType=CD_Letter, recordID=F879D7B8-0338-418D-A330-6B9DF7947C6A:(com.apple.coredata.cloudkit.zone:__defaultOwner__), values={
"CD_content" = "Dear User. Happy Valentine's Day! Today. l want to remind you of how much you mean to me. Your presence in my life fills my heart with joy and love. Thank you for being my confidant, my friend, and my love. Every moment with you is precious, and I look forward to creating many more beautiful memories together. With all my love, Thomas";
"CD_createdAt" = "2024-07-30 03:17:13 +0000";
"CD_date" = "2024-07-30 03:15:58 +0000";
"CD_emotion" = Lovely;
"CD_entityName" = Letter;
"CD_icon" = "❤️🔥";
"CD_id" = "81569A99-E74C-43AF-B346-220A75EA336E";
"CD_imageData" = "{ length=282816, sha256=a76343766534e061472e243deec7f0b428c85e8a6b94e6cd761443c45f5be41c }";
"CD_primaryAlpha" = "0.4313725490196079";
"CD_primaryBlue" = 0;
"CD_primaryGreen" = "0.09014883061658401";
"CD_primaryRed" = "0.4156862745098039";
"CD_secondaryAlpha" = 1;
"CD_secondaryBlue" = "0.8823529411764706";
"CD_secondaryGreen" = "0.8784313725490196";
"CD_secondaryRed" = "0.9490196078431372";
"CD_sender" = "EF893D7E-E9E9-453B-B76E-6A5D77E14AA3";
"CD_tertiaryAlpha" = 1;
"CD_tertiaryBlue" = "0.8823529411764706";
"CD_tertiaryGreen" = "0.8784313725490196";
"CD_tertiaryRed" = "0.9490196078431372";
"CD_title" = "I love you";
}>
Despite this, no records are found in the CloudKit Dashboard.
Request for Assistance
Are there any additional steps I might have missed to ensure that records sync correctly with CloudKit?
Could there be any known issues or additional configurations required for syncing Core Data with CloudKit?
Any advice on further troubleshooting steps or areas to investigate would be greatly appreciated.
Thank you for your time and assistance!
Hi, I'm using CloudKit to create an app that backs up and records your data to iCloud.
Here's what I'm unsure about:
I understand that the 'CloudKit Dashboard' has 'Security Roles'. I thought these were meant to set permissions for accessing and modifying users' data, but I found there was no change even when I removed all 'Permissions' from 'Default Roles'. Can you clarify?
I'd like to know what _world, _icloud, and _creator in Default Roles mean respectively.
I would like to know what changes the creation, read, and write permissions make.
Is it better to just use the default settings?
Here's what I understand so far:
Default Roles:
_world: I don't know
_icloud: An account that is not my device but is linked to my iCloud
_creator: My Device
Permissions:
create: Create data
read: Read data
write: Update and delete data.
I'm not sure if I understand this correctly. Please explain.
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!
How Do I View My CloudKit Invoice?
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?
I can't find the current costs for CloudKit. There used to be a pricing page, but I can't locate it now. Is there an official page that details the current costs for CloudKit?
When query, no record returned:
but using fetch, can see the record, while in a strange status: "Record not found"
While Query Record show error:
{
"code": 500,
"message": "internal-error",
"reason": "Internal error",
"requestUuid": "c10d378f-7133-4bea-a40d-d957f80f5de4"
}
Every record type in this container show same error.
But other containers of my apps works will.
I currently have a production app that uses CloudKit I always struggle with testing the data within the development container and I was wondering if someone could share their current workflow.
What is your current workflow when testing apps that use CloudKit, do you use your regular Apple User account for testing, or you use separate account?
My concern is because I use my production app on a daily basis using my regular Apple user account, so I would like to keep the production iCloud data intact. In other words, I have my app on my phone with real data and now I need to test the app because there are some CloudKit syncing issues so I have the following questions.
Can I connect my phone with production data to Xcode and use my regular Apple account for testing purposes?
Will I be able to see the testing data in the CloudKit console?
Will the production data merge with the testing data?
I actually created a second Apple account thinking that I could use it for testing but logging off and logging back on to iCloud in your iPhone it's a pain, is this really what needs to be done?
Any ideas would be greatly appreciated.
Thanks
In WWDC2020, the video "Synchronizing a local store to the cloud" shows some data fields in the left column of the dashboard, such as CD_post, CD_Tag, where did these come from? need to create it manually on dababoard, or it synchronize from the demo app ?
why do I run this corresponding demo, but there are no data fields in the dashboard of my account
and my dashboard of my account is almost empty?
I am using the public cloud database to store my application data, this data is accessed by all users of the application, but at some point it is necessary for a user who did not create a respective data in the database to delete it, but from what I read in the documentation this is not possible, only with a permission. How do I allow a user to change or delete any data created by another user in the public cloud database?