title: Cannot create an SQL store with a nil URL
body: <p>So I am trying to create a today widget extension using the data stored by the parent app. </p>
  
  <p>I am trying to do so by creating a <code>Persistent Store Coordinator</code> as you do in parent app and using the URL for the main app database.</p>
  
  <p>However when doing so I get the following error; </p>
  
  <blockquote>
    <p>2016-03-13 12:59:02.155 TodayWidget[10942:1456153] Failed to inherit
    CoreMedia permissions from 5079: (null) 2016-03-13 12:59:02.336
    TodayWidget[10942:1456112] *** Terminating app due to uncaught
    exception 'NSInvalidArgumentException', reason: 'Cannot create an SQL
    store with a nil URL.'</p>
  </blockquote>
  
  <p>Here's what I am doing in the Today widget view controller. The <code>containerPath</code> is the same as the bundle identifier for the today extension target. The <code>containerPath?.URLByAppendingPathComponent</code> sql file name is the same as the parent app core data stack sql file name as well as the the <code>modelURL</code> is the same as it is in the parent app.</p>
  
  <pre><code>var context: NSManagedObjectContext!
  
  let fileManager = NSFileManager.defaultManager()
  var containerPath = fileManager.containerURLForSecurityApplicationGroupIdentifier("com.company.APPNAME.TodayWidget")
  
  containerPath = containerPath?.URLByAppendingPathComponent("SingleViewCoreData.sqlite")
  let modelURL = NSBundle.mainBundle().URLForResource("APPNAME", withExtension: "mom")
  let model = NSManagedObjectModel(contentsOfURL: modelURL!)
  let coordinator = NSPersistentStoreCoordinator(managedObjectModel: model!)
      do {
          try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: containerPath, options: nil)
      } catch {
       print("yellow")
      }
  
    context = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
    context.persistentStoreCoordinator = coordinator
  </code></pre>
  
  <p>Does anybody know how I can resolve the error ? </p>
  
  <p>PS: I have enabled and created app groups and added the today widget as a target for the core data model and the subclasses.  </p>