Can't understand what's causing NSRangeException
Can't understand what's causing NSRangeException
- Subject: Can't understand what's causing NSRangeException
- From: Vinayak Suley <email@hidden>
- Date: Wed, 7 May 2008 08:56:29 -0700
Hi,
I'm new to objective-C so this might be elementary for some, but I
can't seem to figure out why this is happening.
Here's two code samples:
ONE:
SpectralData* spectrum = [selectedLightSource
spectralPowerDistribution];
NSMutableArray* lightSourceData1 = [spectrum data];
TWO:
NSMutableArray* lightSourceData2 = [[selectedLightSource
spectralPowerDistribution] data];
If my understanding of objective-C is correct, the second one is just
a short version of writing the first. But the first one works fine and
the second one causes an NSRangeException:
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)'
Both get properties, 'spectralPowerDistribution' and 'data' are really
simple. They just return the member variables of type SpectralData*
and NSMutableArray* respectively.
Any ideas?
Thanks!
Vin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden