Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 10, 2009, 09: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, 10: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, 08: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, 12:45 PM   #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, 01: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

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: Xcode 5: Mac App Store said "An error occurred." moonman239 iPhone/iPad Programming 1 Sep 18, 2013 07:10 PM
Xcode Project "page based app" alaahershy iPhone/iPad Programming 3 Aug 29, 2013 03:10 PM
Iphone 5 UPS Canada "Exception" Status HaxorRob iPhone 9 Nov 1, 2012 08:33 AM
Fedex "Delivery Exception" Alex480 iPhone 8 Sep 21, 2012 11:52 AM
Xcode 4.5 problems - breakpoints I don't want and libc++abi.dylib uncaught exception moonman239 iPhone/iPad Programming 1 Jun 20, 2012 03:09 PM

Forum Jump

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

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

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