title: iCloud sync fails with "CoreData: Ubiquity: Invalid option: the value for NSPersistentStoreUbiquitousContentNameKey should not contain periods"
body: <blockquote>
    <p>CoreData: Ubiquity:  Invalid option: the value for NSPersistentStoreUbiquitousContentNameKey should not contain periods: com.YashwantChauhan.Outis</p>
    
    <p>-PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:: CoreData: Ubiquity:  mobile~20BF44C9-C39F-48DC-A8A1-B45FC82C7E20:com.YashwantChauhan.Outis</p>
  </blockquote>
  
  <p>I have a problem with syncing with iCloud. These two errors above are thrown at me. I don't know what's the problem, I setup the Entitlements file, and set the Ubiquity Container to <code>com.YashwantChauhan.Outis</code>. </p>
  
  <p>I start the CoreData stack using MagicalRecord's method:</p>
  
  <pre><code>[MagicalRecord setupCoreDataStackWithiCloudContainer:@"N6TU2CB323.com.YashwantChauhan.Outis" localStoreNamed:@"Model.sqlite"];
  </code></pre>
  
  <p>But that shouldn't even matter since MagicalRecord just simplifies CoreData methods. </p>
  
  <p>Help much appreciated.</p>
  
  <p><strong>Ok update:</strong> </p>
  
  <blockquote>
    <p>-[NSFileManager URLForUbiquityContainerIdentifier:]: An error occurred while getting ubiquity container URL: Error
    Domain=LibrarianErrorDomain Code=11 "The operation couldn’t be
    completed. (LibrarianErrorDomain error 11 - The requested container
    identifier is not permitted by the client's
    com.apple.developer.ubiquity-container-identifiers entitlement.)"
    UserInfo=0x15e0d8a0 {NSDescription=The requested container identifier
    is not permitted by the client's
    com.apple.developer.ubiquity-container-identifiers entitlement.}</p>
  </blockquote>
  
  <p>This is the latest error message I got, I realize this differs from the question's initial error but it so turns out that the old message was some kind of strange bug of sorts. I tried @Rauru Ferro's solution by removing the periods from my Ubiquity Container identifier. I knew that this wouldn't work because the requirements for the identifier is to contain periods, but then when I put the periods back in, it spat the error message above. Which makes more a lot more sense than not using periods. We all know that we <strong><a href="https://developer.apple.com/library/mac/documentation/General/Conceptual/iCloudDesignGuide/Chapters/iCloudFundametals.html" rel="noreferrer">do</a></strong>.</p>
  
  <p>I also found this handy code snippet that can actually checks my Ubiquity Container identifier by fetching it. Useful snippet to quickly check if you have any problems with it. </p>
  
  <pre><code>NSString *containerId = @"com.YashwantChauhan.Outis";
  NSFileManager *fileManager = [NSFileManager defaultManager];
  NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:containerId];
  NSLog(@"%@", [iCloudURL absoluteString]);
  </code></pre>
  
  <p><strong>Another update:</strong> By the looks of it, this stupid <code>NSPersistentStoreUbiquitousContentNameKey should not contain periods</code> is a whole mess. If <code>NSPersistentStoreUbiquitousContentNameKey</code> is created like some kind of folder (<a href="http://www.axelpeju.com/blog/2012/01/31/core-data-and-icloud/" rel="noreferrer">Tutorial</a>), then the requirement is that there is no <code>.</code> infront of the name, like <code>.com.YashwantChauhan.Outis</code> but that is not the case. I am starting to go mad here! There is no problem with the Entitlements file and there is nothing with fetching the iCloud container ID in MagicalRecord. I am starting to think this is an internal problem with setting up iCloud in Xcode 5, but of course I don't know. With this said, I might just be loosing my mind over something trivial or something that will actually cause a headache for other people. </p>
  
  <p>Can anybody post their Entitlements file so I can verify how an actual working version looks like. Redacted of course. Thank you!</p>