CloudKit,无法修改某些记录 - 未找到区域

CloudKit, Failed to modify some records - Zone Not Found

我收到以下错误。

ERROR[CKErrorDomain:2] Failed to modify some records, 
<CKError 0x1c005e1e0: "Partial Failure" (1011); "Failed to modify some records"; 
partial errors: {
BB27A0F8-0D8A-4279-A4E6-515B4E6C5116:(MainCustomZone:__defaultOwner__) = 
<CKError 0x1c0050740: "Zone Not Found" (26/2036); server message = "Zone 'MainCustomZone' 
does not exist"; uuid = E4AE311D-A73F-4F8A-BAF7-1EF5082D2FA9>
}>

我的应用程序在我的开发设备上运行良好,但在我的测试版用户的测试中,他们遇到了上述错误。当我使用 testflight 构建时,它对我来说仍然可以正常工作,是的,我指的是我的权利中的生产容器,我已将 'com.apple.developer.icloud-container-environment' 设置为“生产”。

我已经三重检查我正在寻找正确的容器并且区域名称拼写正确。

我在应用程序 ID 下的开发者帐户中启用了 iCloud。

我还在每个记录类型的安全角色中设置了用于身份验证的写入集。

有人能告诉我问题出在哪里吗? 我一直在研究这个问题但没有成功。

下面是创建我使用的区域的一些典型代码。

CKFetchRecordChangesOperation *changesOperation = [[CKFetchRecordChangesOperation alloc]
                                                   initWithRecordZoneID: [self customZone]
                         previousServerChangeToken: previousServerChangeToken];

-(CKRecordZoneID*)customZone
{
    return [[CKRecordZoneID alloc] initWithZoneName: cCUSTOM_ZONE
                                          ownerName: CKOwnerDefaultName];
}

数据库中只有一个区域 - 默认区域。如果您的应用程序正在使用任何其他区域,您的应用程序必须在尝试访问(或写入)该区域中的任何记录之前创建该区域。

您可能在某个时候创建​​了开发区,这就是代码在那里工作的原因。

屏幕截图显示的是您的 私人数据库。每个用户都有自己的私人数据库,您无法在仪表板中看到其他用户的私人数据库。您需要在您的应用程序中通过代码创建区域。