即使配置正确,URLForUbiquityContainerIdentifier也会返回nil [英] URLForUbiquityContainerIdentifier returns nil even if configured correctly
问题描述
我遇到了问题,即使用户在设置中正确设置了所有内容,URLForUbiquityContainerIdentifier在某些情况下也会返回nil。我的代码:
I am having the problem, that URLForUbiquityContainerIdentifier is returning nil in some cases even if the user has set up everything correctly in the settings. My code:
dispatch_async(someQueue, ^{
if (![[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]) {
ErrLog(@"iCloud container not available.");
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[...]
});
});
有人遇到同样的问题吗?我将nil设置为容器标识符,该标识符应该根据Apple文档工作,但我对此不再那么信服。此代码也适用于大多数用户,但不是每个人都适用。
Does anybody came across the same problem? I am setting nil as the container identifier which should work according to the Apple docs, but I am not so convinced anymore about that. Also this code works fine for the majority of users, but somehow not for everybody.
推荐答案
iPad mini与iOS7。我刚刚经历过URLForUbiquityContainerIdentifier突然开始返回nil。我尝试重新启动设备,但没有帮助。
iPad mini with iOS7. I just have experienced that URLForUbiquityContainerIdentifier suddenly started to return nil. I tried restarting the device, but it didn't help.
在设置应用内,在iCloud菜单下。我注意到'文件&数据'设置为关闭。
Inside the Settings app, under the 'iCloud' menu. I noticed that 'Documents & Data' was set to Off.
解决方案是改变'文件&数据'到'开'。
Solution was to change 'Documents & Data' to 'On'.
这篇关于即使配置正确,URLForUbiquityContainerIdentifier也会返回nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!