CloudKit Dashboard

RSS for tag

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

Posts under CloudKit Dashboard tag

31 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Unexpected “OTHER” error in CloudKit despite app functioning normally
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!
5
2
755
Oct ’24
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
694
Sep ’24
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
604
Sep ’24
"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.
5
0
990
Aug ’24
Core Data Records Not Syncing with CloudKit Dashboard
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!
1
0
1.1k
Jul ’24
Questions About CloudKit Security Roles and Permissions
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.
1
0
989
Jul ’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
3
598
Jul ’24
How can a user change some data in the public data base?
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?
1
0
684
Jun ’24
Cloudkit Coredata reset upon user logout iCloud
Hi all, We have an iOS app which has Cloudkit Coredata as storage mechanism. Whenever user logout of iCloud in settings app, then the Coredata is wiped out and no row exists in the tables. Can we prevent this. We want to retain the coredata values until there is another iCloud user logs into settings app. Thanks Vinoth
4
1
1.4k
Aug ’24