• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
XML Store Type and Stalling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XML Store Type and Stalling


  • Subject: XML Store Type and Stalling
  • From: Duncan Alexander Oliver <email@hidden>
  • Date: Fri, 26 May 2006 13:03:05 -0500

I've been having a weird problem with a Core Data application I've come back to after a couple of months. As far as I can recall, I wasn't having this problem before this hiatus.

After the program has set up the managed object context as well as the persistent store coordinator, it appears to lock up. The application still appears "responsive" to the system (through the dock menu and force quit window), but the menus won't respond and it won't accept any key commands. Changing the location in which the store is loaded to and saved from does not help. However changing the store type to NSSQLiteStoreType allows the application to run as normal.

Here is the relevant code for loading the file:

- (CompassCollection *)collection
{
//Check to see if the managed object context is already initialized
if (!collection)
{
//Create user's collection
collection = [[CompassCollection alloc] init];
[collection setValue:NSLocalizedString(@"My Collection", @"This is the label for the user's bookmark collection.")
forKey:@"name"];

//Make a managed object model from all the models in the main bundle
NSManagedObjectModel *managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
//Create a presistent store coordinator from the newly merged object model
NSPersistentStoreCoordinator *persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel];
//Find a path to this application's Application Support folder
NSString *collectionPath = [[NSSearchPathForDirectoriesInDomains (NSApplicationSupportDirectory,NSUserDomainMask,YES) objectAtIndex:0] stringByAppendingPathComponent:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleExecutable"]];
//Append the filename of the collection file to the path
collectionPath = [collectionPath stringByAppendingPathComponent:CompassCollectionFilename];
//Append the "xml" file extension
collectionPath = [collectionPath stringByAppendingPathExtension:@"xml"] ;
//Create a URL to the file
NSURL *collectionURL = [NSURL fileURLWithPath:collectionPath];
NSError *error;
//Add the collection file to the persistent store coordinator
if(![persistentStoreCoordinator addPersistentStoreWithType:NSXMLStoreType
configuration:nil
URL:collectionURL
options:nil
error:&error])
[[NSApplication sharedApplication] presentError:error];

//Initialize the context
NSManagedObjectContext *managedObjectContext = [[NSManagedObjectContext alloc] init];
//Add the persistent store coordinator to the managed object context
[managedObjectContext setPersistentStoreCoordinator:persistentStoreCoordinator];
[collection setValue:managedObjectContext
forKey:@"managedObjectContext"];
}

//Return the collection managed object context
return collection;
}



Any ideas on why the XML store type is freezing up the program and how to resolve it? Thanks in advance.
---
Duncan Oliver
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Prev by Date: Re: ssl.h linking error
  • Next by Date: Re: NSSecureTextFieldCell in NSTableView
  • Previous by thread: Re: problem with NSBrowser
  • Next by thread: Height of wrapped attributed string with -boundingRectWithSize:options:
  • Index(es):
    • Date
    • Thread