On 7 May '08, at 8:56 AM, Vinayak Suley wrote:

If my understanding of objective-C is correct, the second one is just a short version of writing the first.

Yup.

But the first one works fine and the second one causes an NSRangeException:

That's odd. Something else must be going wrong...

An uncaught exception was raised
*** -[NSCFArray objectAtIndex:]: index (-1877845435( or possibly larger)) beyond bounds (41) *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (-1877845435( or possibly larger)) beyond bounds (41)'

The exception's not being raised directly by those lines, rather by something later on that uses a bogus array index.

You need to run the program with the debugger, setting a symbolic breakpoint at "objc_exception_throw" (in 10.5) or at "NSRaiseError" (10.4), and it'll stop at the exception so you can see the backtrace and variables.

(Rhetorical OT question: Why is it that Xcode has convenient menu commands for setting breakpoints on C++ exceptions, and even on Carbon's DebugStr call, but there's no such command for Objective-C exceptions? Don't they realize that more than a few of us use Objective-C?)

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to