Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 10, 2009, 08:25 PM   #1
GregX999
macrumors newbie
 
Join Date: Apr 2009
XCode - how to "see" an exception that is thrown

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
GregX999 is offline   0 Reply With Quote
Old Apr 10, 2009, 09:57 PM   #2
kpua
macrumors 6502
 
Join Date: Jul 2006
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.
kpua is offline   0 Reply With Quote
Old Apr 11, 2009, 07:56 AM   #3
GregX999
Thread Starter
macrumors newbie
 
Join Date: Apr 2009
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)
GregX999 is offline   0 Reply With Quote
Old Apr 11, 2009, 11:45 AM   #4
kpua
macrumors 6502
 
Join Date: Jul 2006
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.
kpua is offline   0 Reply With Quote
Old Apr 11, 2009, 12:13 PM   #5
GregX999
Thread Starter
macrumors newbie
 
Join Date: Apr 2009
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
GregX999 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Xcode - how to debug a non-Xcode program? daihard Mac Programming 8 Feb 11, 2011 03:32 PM
How to burn a DVD that is .avi and with subtitles that are .srt and .sub ? sun surfer Mac Applications and Mac App Store 1 Jul 23, 2010 10:55 PM
Xcode - How to open more than 1 project in Groups & Files? mcbi4kh2 Mac Programming 8 May 9, 2010 12:39 PM
Xcode+Java - How to call an application's exe ? Kathe Mac Programming 8 Apr 30, 2009 09:11 AM
Xcode - How to Delete Projects? R7alph Mac Applications and Mac App Store 1 Mar 24, 2009 12:31 AM


All times are GMT -5. The time now is 11:41 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC