• 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
writeToFile: causes app to crash when save on quit.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

writeToFile: causes app to crash when save on quit.


  • Subject: writeToFile: causes app to crash when save on quit.
  • From: Ron Ballesteros <email@hidden>
  • Date: Tue, 30 Dec 2003 16:15:26 -0800

Hi ,

So I have a small app that saves a tree data structure that is composed
of NSMutableDictionary, NSMutableArray and NSStrings. Before the
application completely quits I save the tree structure to a file using
writeToFile: of NSDictionary.

However when the application is about to quit, the application exits
due to signal 11 (SIGSEGV) and it occurs when attempting writeToFile.
I thought that maybe I was releasing some of the objects contained in
the structure to early so I commented out the code that adds content to
the structure and just left initialized to it's empty form and it still
crashed.

I know I'm missing something very obvious and stupid but forgive me as
I can't seem to trace it down.

Thanks .
~r

Below is the snippet of my code: where I create the initial tree
structure and when I save it:

- (id)init {

if (self = [super init]) {

//Initliaze and create the rootNode
NSString *rootName = @"schedules";
NSMutableArray *sevenDaySchedules = [[NSMutableArray alloc] init];

//rootNode is an instance variable
rootNode = [NSMutableDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:rootName,sevenDaySchedules, nil] forKeys:
[NSArray arrayWithObjects:@"rootName", @"sevenDaySchedules", nil]];

}

return self;
}

- (NSApplicationTerminateReply)applicationShouldTerminate:(id)sender
{
NSString *scheduleStorePath = [NSHomeDirectory()
stringByAppendingPathComponent:@"Documents/schedules.hrs"];

[rootNode writeToFile:scheduleStorePath atomically:YES];

return NSTerminateNow;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: writeToFile: causes app to crash when save on quit.
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
  • Next by Date: Re: NSArrayController & threads
  • Previous by thread: Re: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
  • Next by thread: Re: writeToFile: causes app to crash when save on quit.
  • Index(es):
    • Date
    • Thread