Re: Rookie question. Where did expection raised!?
Re: Rookie question. Where did expection raised!?
- Subject: Re: Rookie question. Where did expection raised!?
- From: Jeff LaMarche <email@hidden>
- Date: Tue, 3 Dec 2002 17:12:35 -0500
On Tuesday, December 3, 2002, at 04:53 PM, Aidas Dailide wrote:
>
I guess it says that my objectAtIndex range is too big, but my app has
>
many
>
objectAtIndexes and i can't find wich one does that. How to know wich
>
one
>
objectAtIndex raised this?
There's a couple of things going on here that can be confusing. It
looks like you're using NSArray's objectAtIndex - NSArray, like most of
the collection classes, is a class cluster, which is why you're seeing
an exception raised from NSCFArray rather than your class. I would look
for places where you are using NSArray objectAtIndex and wrap it in
exception handler macros, something like this:
NS_DURING
id myObject = [myArray objectAtIndex:5];
NS_HANDLER
NSLog([NSString stringWithFormat: @"Exception in send :
%@",[localException reason]]);
// Do anything else appropriate to the error
NS_ENDHANDLER
By doing this, you're "catching" the exception rather than letting it
fall through. You don't necessarily need to do anything with it, but
even if you don't, still wrap it in the handler so that the system
knows you intended to ignore the exception...
If you don't know where you are using NSArray that might be causing the
problem, try running your application in the debugger. At the point the
exception is raised, you'll be able to tell from the stack trace where
it is happening.
Hope this helps.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.