title: App Crash if iCloud is on (linked to sync with coreData)
body: <p>This is the code i used in the init for storage class and it worked fine until recently.. when i tried testing it, it crashes (marked below) at addPersistentStoreWithType ... i noticed this after switching to the iPhone 5 and was trying to run the app... but if i turn off icloud on my phone or test it on the simulator there are no problems... </p>
  
  <pre><code>-(id)init
  {
      self = [super init];
      if(self)
      {
          NSLog(@"%s", __FUNCTION__);
          favColors = [[NSMutableArray alloc] init];
          model = [NSManagedObjectModel mergedModelFromBundles:nil];
          NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];
          NSString *path = [self itemArchivePath];
          NSURL *storeURL = [NSURL fileURLWithPath:path];
          NSError *error = nil;
          NSMutableDictionary *options = [NSMutableDictionary dictionary];
  
          NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
          if (ubiq) {
              NSLog(@"iCloud access at %@", ubiq);
              [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(contentChange:) name:NSPersistentStoreDidImportUbiquitousContentChangesNotification object:nil];
              NSFileManager *fm = [NSFileManager defaultManager];
              NSURL *ubcontainer = [fm URLForUbiquityContainerIdentifier:nil];
              [options setObject:@"color" forKey:NSPersistentStoreUbiquitousContentNameKey];
              [options setObject:ubcontainer forKey:NSPersistentStoreUbiquitousContentURLKey];
  
          } else {
              NSLog(@"No iCloud access");
          }
     // ************ Crash here **************
          if (![psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:(ubiq?options:nil) error:&amp;error]) {
              [NSException raise:@"Open failed" format:@"Reason: %@", [error localizedDescription]];
          }
          context = [[NSManagedObjectContext alloc] init];
          [context setPersistentStoreCoordinator:psc];
          [context setUndoManager:nil];
  
          [self loadAllItems];
      }
      return self;
  }
  
  - (NSString *)itemArchivePath
  {
      NSArray *documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentDirectory = [documentDirectories objectAtIndex:0];
      return [documentDirectory stringByAppendingPathComponent:@"store.data"];
  }
  </code></pre>
  
  <p>Also if i run the app once and turn off icloud after the crash and run the app again.. the data is retrieved from icloud... and shows on app.</p>
  
  <p>The out put log shows this.</p>
  
  <blockquote>
    <p>iCloud access at file://localhost/private/var/mobile/Library/Mobile%20Documents/xxx
    -PFUbiquitySetupAssistant performPreStoreSetupWithError:: CoreData: Ubiquity:  
    The baseline file exists, but could not be read</p>
  </blockquote>