🔦

CloudKit Debugging: How to View Data for Test Accounts

TL;DR: The CloudKit Console defaults to showing data only for your developer account. To inspect data generated by a “personal account” or a “Sandbox test user” on a real device, you must switch contexts by clicking the “Act As iCloud Account” button.

The Problem

Many developers encounter a classic source of confusion when building cloud sync features with Core Data or SwiftData:

You successfully write data using a test account (or your personal daily driver) on a real device, and the sync status looks fine, yet when you query records in the CloudKit Dashboard (Console), it comes up empty.

The Root Cause

This is due to CloudKit’s strict privacy isolation mechanisms:

  1. Identity Mismatch: The CloudKit Console logs in with your Apple Developer ID by default.
  2. Data Isolation: Data in the Private Database is strictly segregated. The developer account can only see its own data; it cannot directly view data generated by other iCloud accounts (including your own non-developer test accounts).

The Solution

The CloudKit Console provides a feature called “Act As iCloud Account”, allowing developers to “impersonate” another iCloud user within the console session to inspect their private data.

Steps

  1. Log in to the CloudKit Console.

  2. Enter your App’s container and click the “Act As iCloud Account” button in the left sidebar of the page.

    CloudKit Act As iCloud Account Button

  3. In the popup window, enter the iCloud email and password of the account you are using on your simulator or physical device.

    CloudKit Login Window

  4. Once logged in successfully, the results of Query Records will display the data belonging to that specific test account.

Important Notes

  • Session Volatility: This login state is temporary. If you refresh the page, switch Containers, change environments (Development/Production), or click “Stop Acting As…”, you will automatically be logged out of the test account and revert to your developer account.
  • Two-Factor Authentication: If the test account has Two-Factor Authentication (2FA) enabled, you will be required to enter the verification code just as you would for a standard login.
Related Tips

Subscribe to Fatbobman

Weekly Swift & SwiftUI highlights. Join developers.

Subscribe Now