Exception thrown?


#1

I get an exception thrown in the following block of code:

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError { // Insert code here to write your document to data of the specified type. If outError != NULL, ensure that you create and set an appropriate error when returning nil. // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. NSException *exception = [NSException exceptionWithName:@"UnimplementedMethod" reason:[NSString stringWithFormat:@"%@ is unimplemented", NSStringFromSelector(_cmd)] userInfo:nil]; @throw exception; return nil;

in the line @throw exception; i get a green dart with the message:thread 1: signal SIGABRT

In the debug log i get the following message following the exception line:
dataOfType:error: is unimplemented

I have checked all the code blocks of the undo implementation for errors, but they are equal to the book. I am using X-code 4.3.2. and I have changed the “index” variables form (int) to (NSInteger) types.

What can it be?

Bertus


#2

I found the solution for this particular problem in the Errata of the fourth edition (by the way editors: why can’t I find the Errata from the third edition anywhere anymore?). In OSX Lion the autosave kicks in whenever you use ‘undo’.
This is what errata of the fourth edition mentions on autosave:

[quote]Chapter 9:
p. 152: “insert:” should be “add:”.

General note: be sure to check the note on page 155: adding Undo to your application will make autosave kick in, which will cause an exception (or an error message). You can ignore the error, or disable autosave by changing -autosavesInPlace to return NO.[/quote]

So with every new update of OSX and/or Xcode you should also buy the new version of this book…

I should stop answering myself…

Bertus