title: Accessing Core Data SQL Database in iOS 8 Extension (Sharing Data Between App and Widget Extension)
body: <p>Problem: </p>
  
  <p>Unable to access application's Core Data database from within a Widget Extension in the Today View.</p>
  
  <p>The app itself is able to read and write to the database as per normal under iOS 8, but the extension will fail to create the store, giving the error, unable to write to file.</p>
  
  <p>The log is the following:</p>
  
  <pre><code>Error Domain=NSCocoaErrorDomain Code=512 "The operation couldn’t be completed. (Cocoa error 512.)"
  
  reason = "Failed to create file; code = 2
  </code></pre>