Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6555273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:47:58+00:00 2026-05-25T12:47:58+00:00

i’ve checked several posts on the internet and stackOverflow but couldn’t find an answer

  • 0

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..

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
  [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
  [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];

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…

-(NSPersistentStoreCoordinator *)persistentStoreCoordinator{…} is at the bottom!

Help is greatly appreciated!

#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] > 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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:47:59+00:00Added an answer on May 25, 2026 at 12:47 pm

    Not sure if you fixed your error, but check out: I keep on getting "save operation failure" after any change on my XCode Data Model

    Also for me, I had the same storecordinator sqlite name as another project I was working on and had already ran…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.