简体   繁体   English

iOS Cloudkit fetchRecordWithID没有返回响应

[英]iOS Cloudkit fetchRecordWithID is not returning a response

This case is happening on only one particular test device (xs-max). 这种情况仅在一个特定的测试设备(xs-max)上发生。 The other devices we could not replicate this. 我们无法复制其他设备。

The completion block for fetchRecordWithID isn't executing no matter how long I wait. 无论我等待多长时间,fetchRecordWithID的完成块都不会执行。

Here is the code I call on tap of button. 这是我在点击按钮时调用的代码。

//recordID is not nil

[[[CKContainer defaultContainer] privateCloudDatabase]fetchRecordWithID:recordID completionHandler:^(CKRecord * _Nullable record, NSError * _Nullable error) {

        if (record) {
            //save record
        }else{
            NSLog(@"%@",error);
        }

    }];

I couldn't debug this as the execution never reaches the block. 我无法调试它,因为执行从未到达该块。

Any case this might happen ? 任何情况下都可能发生吗?

I am not sure if this is the case, but the device iCloud settings are not loaded properly. 我不确定是否是这种情况,但是设备iCloud设置未正确加载。

We had to restart the device which prompted to re-validate the apple ID in the settings. 我们必须重新启动设备,提示重新设置中的apple ID。

Once the validation is done, the icloud settings are shown as expected. 验证完成后,icloud设置将按预期显示。 And there after, the code executed as expected. 之后,代码按预期执行。

Adding screenshot for reference. 添加屏幕截图以供参考。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM