问题描述
在模拟器中保存CKRecord会出现以下错误:
Saving a CKRecord in the simulator gives me the following error:
[publicDatabase saveRecord:cloudRouteEntity
completionHandler:^(CKRecord *record, NSError *error) {
if (error) {
NSLog(@"An error occured in %@: %@", NSStringFromSelector(_cmd), error);
abort();
} else {
dispatch_async(dispatch_get_main_queue(), ^(void) {
//gui
NSLog(@"Created Cloudkit Entity");
});
}
}];
但是,它适用于手机。为什么模拟器无法访问CloudKit数据库?
However, it works on the phone. Why does the simulator not have access to the CloudKit database?
编辑:我认为通过将iCloud帐户添加到模拟器我会很聪明 - 但iCloud呻吟说这个不允许在此设备(模拟器)上。想法有人吗?
I thought I'd be clever by adding the iCloud account to the simulator - but iCloud moans that this is not allowed on "this device" (simulator). Ideas anyone?
推荐答案
我遇到了同样的问题,我可以通过登录我的iCloud帐户来解决在模拟器中(设置> iCloud)。
I got the same problem, which I was able to resolve by logging in to my iCloud account in the simulator (Settings > iCloud).
从最新的Xcode开始,您可以在模拟器中登录到您的iCloud帐户,一切都应该有效。
As of the latest Xcode, you can log in to your iCloud account in the simulator, and everything should work.
如果您在登录时遇到问题,请尝试在桌面上访问iCloud.com并首先登录。一旦设置正确,然后在模拟器中尝试。
If you are having trouble logging in, try to go to iCloud.com on a desktop and log in there first. Once that is set up properly, then try in the simulator.
这篇关于保存CloudKit记录“未经过身份验证” (一千〇二分之九)" “此请求需要经过身份验证的帐户”"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!