"Not Authenticated" (9/1002) 访问云套件 public 数据库时出错
"Not Authenticated" (9/1002) error while accessing cloud kit public database
我已经在我的一个 iOS 应用程序中集成了 cloudkit 框架,并且在 iOS 8 和 9 中工作正常,但在 iOS 10 中没有。它失败了在没有活动 iCloud 帐户的情况下从 public 数据库中获取记录。如果用户也限制了应用程序的 iCloud 驱动器,则能够在 iOS 8 和 9 中获取记录,但它在 iOS 10 中失败,出现类似
的错误
CKError 0x170249090: "Not Authenticated" (9/1002); "No backing
account, so not returning an auth token."
它不适用于 iOS 设备中的开发和生产 cloudkit 环境。
我已经使用指向生产的 AdHoc 构建测试了该应用程序。
下面是我的代码
CKQuery *query = [[CKQuery alloc] initWithRecordType:@"RecordSettings" predicate:[NSPredicate predicateWithFormat:@"TRUEPREDICATE"]];
CKQueryOperation *queryOperation = [[CKQueryOperation alloc] initWithQuery:query];
queryOperation.queuePriority = NSOperationQueuePriorityVeryHigh;
queryOperation.recordFetchedBlock = ^(CKRecord *record) {
if(record != nil) {
}
};
queryOperation.queryCompletionBlock = ^(CKQueryCursor * __nullable cursor, NSError * __nullable operationError) {
NSLog(@"iCloud error: %@", operationError.description);
};
[[[CKContainer defaultContainer] publicCloudDatabase] addOperation:queryOperation];
您需要在模拟器或设备上使用您的iCloud 帐户登录。它对我有用。
答案在Enter iCloud Credentials Before Running Your App部分:
In development, when you run your app through Xcode on a simulator or a device, you need to enter iCloud credentials to read records in the public database. In production, the default permissions allow non-authenticated users to read records in the public database but do not allow them to write records.
我遇到了同样的问题。在 iOS10 之前一切都很好。到目前为止,我发现唯一可以解决此问题的方法是让用户在其设备上启用 iCloud Drive 以获取 public 容器中的任何记录。我正在向 Apple 提交错误报告!
从 iOS 10.0 到 10.1.1 存在此问题,但已在 中解决iOS10.2.
我已经在我的一个 iOS 应用程序中集成了 cloudkit 框架,并且在 iOS 8 和 9 中工作正常,但在 iOS 10 中没有。它失败了在没有活动 iCloud 帐户的情况下从 public 数据库中获取记录。如果用户也限制了应用程序的 iCloud 驱动器,则能够在 iOS 8 和 9 中获取记录,但它在 iOS 10 中失败,出现类似
的错误CKError 0x170249090: "Not Authenticated" (9/1002); "No backing account, so not returning an auth token."
它不适用于 iOS 设备中的开发和生产 cloudkit 环境。 我已经使用指向生产的 AdHoc 构建测试了该应用程序。
下面是我的代码
CKQuery *query = [[CKQuery alloc] initWithRecordType:@"RecordSettings" predicate:[NSPredicate predicateWithFormat:@"TRUEPREDICATE"]];
CKQueryOperation *queryOperation = [[CKQueryOperation alloc] initWithQuery:query];
queryOperation.queuePriority = NSOperationQueuePriorityVeryHigh;
queryOperation.recordFetchedBlock = ^(CKRecord *record) {
if(record != nil) {
}
};
queryOperation.queryCompletionBlock = ^(CKQueryCursor * __nullable cursor, NSError * __nullable operationError) {
NSLog(@"iCloud error: %@", operationError.description);
};
[[[CKContainer defaultContainer] publicCloudDatabase] addOperation:queryOperation];
您需要在模拟器或设备上使用您的iCloud 帐户登录。它对我有用。
答案在Enter iCloud Credentials Before Running Your App部分:
In development, when you run your app through Xcode on a simulator or a device, you need to enter iCloud credentials to read records in the public database. In production, the default permissions allow non-authenticated users to read records in the public database but do not allow them to write records.
我遇到了同样的问题。在 iOS10 之前一切都很好。到目前为止,我发现唯一可以解决此问题的方法是让用户在其设备上启用 iCloud Drive 以获取 public 容器中的任何记录。我正在向 Apple 提交错误报告!
从 iOS 10.0 到 10.1.1 存在此问题,但已在 中解决iOS10.2.