views:

309

answers:

3

I followed Chapter 8 of Hillegass to implement the RaiseMan application there. Then I decided to follow the same process to implement the code for an exercise in a Cocoa programming class that I am taking, but I got the following very cryptic error message after building and running.

Cannot create BOOL from object <_NSControllerObjectProxy: 0x100460e30> of class _NSControllerObjectProxy

I have no idea what this error message means. Doing a Google search brought up some hits, but their remedies seemed to be to do things that I was already doing.

I stared at all the connections and assignments that I made in Interface Builder and nothing looks obviously wrong.

So I went into the debugger and set a breakpoint inside the init method of the MyDocument class and it is being called twice. How could that happen? What should I be looking for that would make the init method be called twice? The stack trace shows that init is called by system functions that we did not write ourselves.

For comparison, I went back to the project that follows Chapter 8 of Hillegass and set a breakpoint inside the init method of the MyDocument class, and it is being called once ( which is what one would expect ).

A: 

If you want someone to tell you why you're getting an error message you'll need to share the code responsible for generating it. Lots of Cocoa programmers don't own any books by Aaron Hillegass.

Azeem.Butt
Posting the stack traces mentioned would be great too
nall
Even if we all had the third edition of the Hillegass book, it wouldn't matter. We can assume that Hillegass's code works; the problem is more likely some step that the questioner missed or did wrong.
Peter Hosey
+1  A: 

Cannot create BOOL from object <_NSControllerObjectProxy: 0x100460e30> of class _NSControllerObjectProxy

It appears you've bound a BOOL property to a controller, and not specified a model key path. Most probably, you bound one of the Cocoa view classes' built-in bindings, such as enabled or editable.

Look through your nib for views whose enabled or editable you've bound, and make sure they are all bound to the correct model key path.

Peter Hosey
A: 

I just ran into this myself. And then I remembered seeing something odd before, whose significance hadn't struck me at the time. Which is that in my XIB file, there was a "My Document" object, in addition to the "File's Owner" object (which is what actually represents the document in the XIB file). I have no idea how it got there, but I deleted it in IB, recompiled, and presto, [MyDocument init] only gets called once now.

Rajiv