• 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
Re: NSArray's objectAtIndex compiles to objectAtIndexedSubscript? SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray's objectAtIndex compiles to objectAtIndexedSubscript? SOLVED


  • Subject: Re: NSArray's objectAtIndex compiles to objectAtIndexedSubscript? SOLVED
  • From: Bill Cheeseman <email@hidden>
  • Date: Sun, 09 Mar 2014 09:17:59 -0400

I just realized that there is a bug in my +QSWStandardizedSystemVersion method that explains the crash. The fault is NOT the -objectAtIndex: message. It is instead the 3
versionComponentStrings[x] subscripted messages, which of course compile to -objectAtIndexedSubscript:. I was thinking of versionComponentStrings as a C array when it is actually an NSArray object.

    NSArray *versionComponentStrings = [versionString componentsSeparatedByString:@"."];
	static unsigned long sBCDSystemVersion = 0;
    SInt32 majorVersion = ([versionComponentStrings count] >= 1) ? [versionComponentStrings[0] intValue] : 0;
    SInt32 minorVersion = ([versionComponentStrings count] >= 2) ? [versionComponentStrings[1] intValue] : 0;
    SInt32 bugFixVersion = ([versionComponentStrings count] >= 3) ? [versionComponentStrings[2] intValue] : 0;

Sorry for the noise.

--

Bill Cheeseman - email@hidden
_______________________________________________

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


  • Prev by Date: Re: NSArray's objectAtIndex compiles to objectAtIndexedSubscript?
  • Next by Date: Re: NSArray's objectAtIndex compiles to objectAtIndexedSubscript?
  • Previous by thread: Re: NSDecimalNumber queries
  • Next by thread: WebView pdf representation - div background colours AWOL
  • Index(es):
    • Date
    • Thread