• 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
How to make Obj-C collection subscripting work on iOS 5?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to make Obj-C collection subscripting work on iOS 5?


  • Subject: How to make Obj-C collection subscripting work on iOS 5?
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 20 Aug 2012 12:52:03 -0700

I've just "modernized" a bunch of cross-platform code in Xcode 4.4, to use the new Obj-C literal and collection-access syntax. Works great when built for Mac OS. But now I discover that the code gets tons of compile errors on iOS because in the 5.1 SDK the NSArray and NSDictionary classes don't declare the -objectForKeyedSubscript: or -objectForIndexedSubscript: methods.

Presumably this will be remedied in the hypothetical future release of Xcode that includes the iOS 6 SDK. But is there anything I can do until then to make this build and run on iOS 5.1?

(And does this also imply that code using array/dictionary subscripting won't run on OS X 10.7?)

My first thought was to declare some categories on NSArray and NSDictionary to define those methods, but that's likely to cause issues when iOS 6 comes out and already includes those methods — I'll get compile errors (which I can work around with #ifdefs) but also a warning at launch time because the methods are declared in two places.

(Note that I'm _not_ asking anything about NDA'd beta software; I'm only asking how to make the compiler feature already available in Xcode 4.4 work on the already-available iOS 5.1.)

—Jens
_______________________________________________

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: How to make Obj-C collection subscripting work on iOS 5?
      • From: Greg Parker <email@hidden>
    • Re: How to make Obj-C collection subscripting work on iOS 5?
      • From: Dave DeLong <email@hidden>
    • Re: How to make Obj-C collection subscripting work on iOS 5?
      • From: Jens Alfke <email@hidden>
    • Re: How to make Obj-C collection subscripting work on iOS 5?
      • From: Charles Srstka <email@hidden>
  • Prev by Date: Re: Apple Aperture-like look & feel
  • Next by Date: NSSplitView crash upon restore from 10.8 Versions Browser
  • Previous by thread: Re: Adding localization on Xcode 4.4
  • Next by thread: Re: How to make Obj-C collection subscripting work on iOS 5?
  • Index(es):
    • Date
    • Thread