• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Can't understand what's causing NSRangeException
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Can't understand what's causing NSRangeException
      • From: Bob Smith <email@hidden>
    • Re: Can't understand what's causing NSRangeException
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Sending an image to Preview to preview the image
  • Next by Date: Re: Can't understand what's causing NSRangeException
  • Previous by thread: Re: self registering NSValueTransformer and bindings
  • Next by thread: Re: Can't understand what's causing NSRangeException
  • Index(es):
    • Date
    • Thread