advertisement

Article:
  Giving the Simple Text Editor 'Legs'
Subject:   I've finally figured this out
Date:   2005-06-19 15:35:30
From:   jz87
Ok, you're getting a 11 error because you're trying to access a non-existent object. I don't know if this changed in Tiger (I'm using Tiger also), but I found that modifying the code in
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
to
[fileData release];
fileData = data;
[fileData retain];
return fileData != nil;
solved the problem. data probably came from the system, and it was probably set as autoreleased. So when you copy the pointer to fileData and access it later you're accessing a non-existing object. That's why you gotta retain it so it doesn't get deallocated when you exist the loadDataRepresentation method. I also put release in there for good measure so we don't end up with a memory leak. Hope this helps.