我正在创建一个通用的 ios 应用程序。URLForUbiquityContainerIdentifier 在我的 iPhone 上测试时似乎工作正常,但在我的 iPad 上却不行——它总是在那里返回 nil。我已经尝试同时传递特定的权利和 nil 并得到完全相同的结果。两台设备都运行 5.0.1,其他云功能在两台设备上都运行良好。我也可以在两个设备上的 iCloud 设置的“管理存储”部分下查看我的应用程序数据。
NSFileManager *fileManager = [NSFileManager defaultManager];
// Migrate datamodel
NSDictionary *options = nil;
// this needs to match the entitlements and provisioning profile
NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:nil]; // <-- comes back as nil on iPad, formatted correctly on iPhone
我一直在研究http://goddess-gate.com/dc2/index.php/post/452教程。
任何想法将不胜感激!