Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

GregX999

macrumors newbie
Original poster
Apr 5, 2009
18
0
I'm trying to follow the lesson for Core Date in the "Cocoa Programming for Mac OS X" book, 3rd ed. (Ch.11), and I built an app using Core Data (so I didn't write any code - it's all IB connections and bindings) that when I run, an exception is thrown. But I have no idea how to figure out what threw the exception or why. Since I didn't write any code myself, it doesn't show an error on a particular line of code.

The exception is thrown right when the program starts.

In the debugger, in the Thread list, it shows:

Code:
 0 objc_exception_throw
 1 +[NSException raise:format:arguments:]
 2 +[NSException raise:format:]
 ...
22 main

Does that mean the formatter I applied to one of the columns in my table view is wrong somehow? There is no data yet, as the program just started - so the table view is empty.

Can anyone help shed some light?

Thanks!
Greg
 

kpua

macrumors 6502
Jul 25, 2006
294
0
Heh... you deleted the most useful part of the backtrace. Show us the rest of it.

Also, something should be logged to the console that should help you out.

It's likely one of your bindings are set up incorrectly.
 

GregX999

macrumors newbie
Original poster
Apr 5, 2009
18
0
I'm sure it's either one of my bindings or one of my connections as I didn't actually write any code. I think my issue is just not knowing how to decipher the backtrace and other debugger output.

Here's the full backtrace:

Code:
#0	0x934f2e17 in objc_exception_throw
#1	0x971a3eeb in +[NSException raise:format:arguments:]
#2	0x971a3f2a in +[NSException raise:format:]
#3	0x95c09126 in -[_NSManagedProxy _entity]
#4	0x95c09379 in -[_NSManagedProxy fetchRequestWithSortDescriptors:limit:]
#5	0x95aab8cc in -[NSArrayController(NSManagedController) defaultFetchRequest]
#6	0x95c08a74 in -[NSObjectController(NSManagedController) _executeFetch:didCommitSuccessfully:actionSender:]
#7	0x95d3803e in _NSSendCommitEditingSelector
#8	0x95b1ed54 in -[NSController _controllerEditor:didCommit:contextInfo:]
#9	0x971a9a3d in __invoking___
#10	0x971a9428 in -[NSInvocation invoke]
#11	0x971a94f8 in -[NSInvocation invokeWithTarget:]
#12	0x94a5022e in __NSFireDelayedPerform
#13	0x9712ab25 in CFRunLoopRunSpecific
#14	0x9712acd8 in CFRunLoopRunInMode
#15	0x94cbd2c0 in RunCurrentEventLoopInMode
#16	0x94cbd0d9 in ReceiveNextEventCommon
#17	0x94cbcf4d in BlockUntilNextEventMatchingListInMode
#18	0x95709d7d in _DPSNextEvent
#19	0x95709630 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#20	0x9570266b in -[NSApplication run]
#21	0x956cf8a4 in NSApplicationMain
#22	0x00001f93 in main at main.m:13

The output of the console doesn't show anything, here it is from start to finish:

Code:
[Session started at 2009-04-11 08:50:24 -0400.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".tty /dev/ttys000
Program loaded.
sharedlibrary apply-load-rules all
run
[Switching to process 52561 local thread 0x2d03]
Running…
(gdb)
 

kpua

macrumors 6502
Jul 25, 2006
294
0
So, is that exception not crashing your program? If you were to continue after breaking on it, do you see a log message then?

It looks like you're binding to a CoreData model. I'm not an expert on CoreData by any stretch of the imagination, but it looks like you're asking the CoreData model for an entity that doesn't exist and it doesn't know how to proceed so it throws an exception.

If you're still clueless, the best approach I can suggest is to debug manually by removing your bindings one at a time and running your program until the exception isn't thrown. Of course, there might be multiple bad bindings, which means you might need to try removing more than one at a time.
 

GregX999

macrumors newbie
Original poster
Apr 5, 2009
18
0
Ahhhhh....

Yes, if I press "Continue" a few times, eventually a friendlier error message appears in the console telling me an entity could not be found - in one of my bindings I used "Cars" instead of "Car".

Thanks for the hint!

Greg
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.