Simulator is in iOS8.1 and I'm using Xcode 6.1.1.
I have tried solutions from several different sources:
And nothing seems to work. My setup:
Entitlements and Capabilities:
Code:
dispatch_async(dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
NSURL *myContainer = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
// unarchive journal object from iCloud
if (myContainer != nil) {
NSString *filePath = [NSString stringWithFormat:@"%@/%@", myContainer.path, ARCHIVE_FILE_NAME];
self.journal = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
// initialize journal from local storage if there's no iCloud archive
if (self.journal == nil)
[self initJournalFromLocalStorage];
else
[self.journal validateUserDefines];
self.journal.cloudURL = myContainer;
dispatch_async (dispatch_get_main_queue (), ^(void) {
// On the main thread, update UI and state as appropriate
});
}
});
My Apple ID has iCloud enabled for both development and distribution; and I've tried creating and downloading a new provisioning profile.
I also tried changing iCloud.$(CFBundleIdentifier) to $(TeamIdentifierPrefix)$(CFBundleIdentifier) in .entitlements.
No matter what I do, URLForUbiquityContainerIdentifier always returns nil. Any help is appreciated!
Do you have iCloud Drive enabled on the simulator?
From my own testing URLForUbiquityContainerIdentifier always returns nil if iCloud Drive is disabled with the iOS 8.1 Simulator. However, if you test on a device with the same setup it will return a valid value. Similarly, if iCloud Drive is enabled then the simulator will return the correct value. If you don't want to enable iCloud Drive then there isn't a workaround other than testing on a real device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With