Todo items not appearing, and then crashing


#1

I’ve noticed the 2 other threads with the trouble I’m having haven’t been resolved, so I’m going to try to front load my post with more info…

To the best of my knowledge I’ve typed everything in correctly. But I’m getting this error:

…it’s showing up here (at the “@throw exception” statement):

- (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; }

Here’s a breakdown of how the program runs:

  1. The window opens with the tableView highlighted by the fuzzy blue section
  2. Typing, clicking insert and any other action except resizing has no effect
  3. Resizing works, but if you push to any extremes, text saying “Your Document Contents Here” slides out from under the table
  4. After you try to enter anything or click insert the program crashes by freezing

As far as I can tell, I have ARC on.


#2

Can’t help you at the moment with the real problems, but I definitely remember running into #3: if you create a new project, you’ll see that there’s a default object (in the GUI sense) in Interface Builder with that text. Deleting that object takes care of it.


#3

Thanks macintux…so 1 down!

Unfortunately, that still leaves the fact that the program isn’t working at all. Any takers? If you need more info, tell me what to grab. I’m a PHP developer, but this Objective-C has been a steep learning curve for me.


#4

Did you have ARC turned on when you first created the project?

I created a project without ARC, and the insert button had no effect. I was getting the SIGABRT error, among others.

One particularly puzzling error involved todoList. I inserted a breakpoint right after [todoList addObject:], and the array would have the new item. Then mysteriously the new item would disappear, leaving todoList empty. Then [todoList count] would crash the program. But I couldn’t count on the same crash every time I ran the program. Very odd.

Going into the project settings and turning on ARC did not make any difference. Aaron warned in another thread that it might not, so I started from scratch with ARC turned on (in the New Project… dialog sequence) and things work now. XCode 4.2.1

Maybe a warning about the need for selecting ARC in the initial creation of the project (or all projects?) could be added to the errata?


#5

I thought I had ARC on, but it didn’t show up in the list macintux mentioned in another post, so I used “refactor” to add it.

I’ll give it a shot. Thanks for the tip.


#6

Ok…totally rebuilt from scratch with the same problem…

A few more bits of information:

  1. I’m running X-Code 4.2.1
  2. The @throw exception (in my first post) continues to persist.
  3. In the Log Navigator (on the left of the X-Code interface), I looked at “Debug TahDoodle”. This is the last line:
  1. In the Debug Navigator, I have a few items in Thread 1:

0 __pthread_kill 9 _objc_exception_destructor 10 -[BNRDocument dataOfType:error:] 11 -[NSDocument writeToUrl:ofType:error:] 39 NSApplicationMain 40 main

I’d be happy to post the code if it matters…but there’s a lot so I’ll only do that if needed.

I have no idea if any of this is useful, but I’m getting pretty frustrated trying to crack this. Are the moderators around? I need some assistance!!


#7

Ugh…it was my fault…I figured it out. I overlooked a step…linking File Owner back to the the NSTableView.

I noticed that one of the gray circles appearing in the margin of BNRDocument.h wasn’t filled in with a dot like the others, but I assumed that was normal since I’m not very familiar with the X-Code interface.

So a tip to the wise…there are 3 ctrl-drag’s needing to be done, and all three of the gray circles (2 in .h, one in .m) should have gray dots in them if you’ve done everything correctly.