title: Keep getting "This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation." upon closing my app (OSX)
body: <p>i've checked several posts on the internet and stackOverflow but couldn't find an answer so far. This is my AppDelegate, as far as I know, those implementations are pretty standard.. i just added the following line and passed the arguments, but it didn't help..</p>
  
  <pre><code>NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
    [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
    [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
  </code></pre>
  
  <p>I cleaned my project, that didn't help either. Also the ApplicationSupport folder does not get created. Is it possible that this is the cause of the problem? I didn't create the App with the option "use core data", but I provided the the necessary methods...</p>
  
  <p>-(NSPersistentStoreCoordinator *)persistentStoreCoordinator{...} is at the bottom!</p>
  
  <p>Help is greatly appreciated!</p>
  
  <pre><code>#import "WebLogClientAppDelegate.h"
  
  // create anonymous catergories for uses in this class
  @interface WebLogClientAppDelegate();
  @property(nonatomic, readonly) NSString *applicationSupportFolder;
  @property(nonatomic, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
  @end
  
  @implementation WebLogClientAppDelegate
  @synthesize autorPrefFeld, benutzerPrefFeld, passwortPrefFeld, hauptfenster,
  managedObjectModel, managedObjectContext, autor;
  
  - (void) applicationWillFinishLaunching:(NSNotification *)notification
  {
      NSLog(@"applicationWillFinishLaunching");
      NSDictionary *defaultsDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Mathias Mustermann", @"autor", 
                                    @"mathias", @"benutzer", 
                                    @"passwort",@"passwort", nil];
      [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDict];
  }
  
  - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
  {
      [moc commitEditing];
      if ([moc hasChanges]) {
          NSLog(@"Save needed!");
          [moc save:nil];
      }
      return NSTerminateNow;
  }
  
  - (NSString *)autor{
      return [[NSUserDefaults standardUserDefaults] stringForKey:@"autor"];
  }
  
  - (void)windowDidBecomeKey:(NSNotification *)notification
  {
      NSLog(@"windowDidBecomeKey");
      NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
      [autorPrefFeld setStringValue:[defaults stringForKey:@"autor"]];
      [benutzerPrefFeld setStringValue:[defaults stringForKey:@"benutzer"]];
      [passwortPrefFeld setStringValue:[defaults stringForKey:@"passwort"]];
  }
  
  - (void)windowDidResignKey:(NSNotification *)notification
  {
      NSLog(@"windowDidResignKey");
      NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
      [defaults setObject:[autorPrefFeld stringValue] forKey:@"autor"];
      [defaults setObject:[benutzerPrefFeld stringValue] forKey:@"benutzer"];
      [defaults setObject:[passwortPrefFeld stringValue] forKey:@"passwort"];
      [defaults synchronize];    
  }
  
  - (NSManagedObjectModel *)managedObjectModel
  {
      if(objectModel){
          return objectModel;
      }
      objectModel= [NSManagedObjectModel mergedModelFromBundles:nil];
      return objectModel; 
  }
  
  - (NSString *)applicationSupportFolder
  {
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
      NSString *basePath = ([paths count] &gt; 0) ? [paths objectAtIndex:0] : NSTemporaryDirectory();
      return [basePath stringByAppendingPathComponent:@"WeblogClient"];
  }
  
  - (NSPersistentStoreCoordinator *)persistentStoreCoordinator
  {
      if (storeCoord) {
          return storeCoord;
      }
  
      NSFileManager *fileManager;
      NSString *applicationSupportFolder;
      NSURL *url;
  
      NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
                               [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
  
      fileManager = [NSFileManager defaultManager];
      applicationSupportFolder = self.applicationSupportFolder;
      if (![fileManager fileExistsAtPath:applicationSupportFolder]) {
          [fileManager createDirectoryAtPath:applicationSupportFolder withIntermediateDirectories:NO attributes:nil error:nil];
      }
      url = [NSURL fileURLWithPath:[applicationSupportFolder stringByAppendingPathComponent:@"WeblogClient.xml"]];
      storeCoord = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.managedObjectModel];
      [storeCoord addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:url options:options error:nil];
      return storeCoord;                 
  }
  
  
  
  - (NSManagedObjectContext *)managedObjectContext
  {
      if (moc) {
          return moc;
      }
      NSPersistentStoreCoordinator *coordinator = self.persistentStoreCoordinator;
      if (coordinator) {
          moc = [NSManagedObjectContext new];
          [moc setPersistentStoreCoordinator:coordinator];
      }
      return moc;
  }
  
  @end
  </code></pre>