Novice: signal 10 memory errors
Novice: signal 10 memory errors
- Subject: Novice: signal 10 memory errors
- From: Michael Hanna <email@hidden>
- Date: Sat, 2 Aug 2003 20:15:35 -0400
Hello, it seems that when I try to get the count from an NSArray I get
signal 10 errors, near the conclusion of my awakeFromNib method:
////////////////////////
//CODE -CSController.m//
// awakeFromNib
//
// this method is automatically called when the program begins
// it initializes the dictionary of arrays from the Bundled
// property list
- (void)awakeFromNib
{
NSString *phrasesPath; // the path to the bundled phrases property
list
NSString *linesPath; // the path to the bundled lines plist
NSString *key = @"lines"; // key to get lineArray
phrasesPath = [[NSBundle mainBundle] pathForResource:@"phrases"
ofType:@"plist"];
linesPath = [[NSBundle mainBundle] pathForResource:@"lines"
ofType:@"plist"];
phraseDict = [NSDictionary dictionaryWithContentsOfFile:
phrasesPath];
lineDict = [NSDictionary dictionaryWithContentsOfFile: linesPath];
keyArray = [phraseDict allKeys];
keyArray = [[phraseDict allKeys]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSLog(@"Key Array: %@", keyArray);
// assign lines plist to data structure
lineArray = [lineDict objectForKey:key];
NSLog(@"Line Array: %@", lineArray); // this outputs OK
NSLog(@"lineArray count: %@", [lineArray count]); // ***** signal
10 error here
}
//CODE -CSController.m//
////////////////////////
From my CSController.h, lineArray is declared 'globally' :
////////////////////////
//CODE -CSController.h//
/* CSController.h */
#import <Cocoa/Cocoa.h>
@interface CSController : NSObject
{
IBOutlet NSImageView *theImageView;
IBOutlet NSTextField *theTextView;
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication
*)sender;
- (IBAction)copyToClipboard:(id)sender;
- (IBAction)generate:(id)sender;
unsigned randPhrase(int length);
NSDictionary *phraseDict; // the sum total of all the possible
phrases
NSDictionary *lineDict; // the lines
NSArray *phraseArray; // an array of phrases for temporary storage
NSArray *lineArray; // the array of lines
NSMutableArray *theSong; // the song lyrics in it's final form,
ready for o/p
NSArray *keyArray; // the list of keys in the phrasesDict, in
lex-order
@end
//CODE -CSController.h//
////////////////////////
/* */
This is a rather straight-forward operation, why would it give me
trouble? I get a signal 11 when doing the same thing in another
method(after the user clicks a button).Sorry about all the noise, but
gosh-darnit I'm going to figure this Cocoa stuff out! :)
Michael
_______________________________________________
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.