On Mar 7, 2014, at 8:50 AM, Kyle Sluder <k...@ksluder.com> wrote:
> On Mar 7, 2014, at 4:54 AM, Bill Cheeseman <wjcheese...@gmail.com> wrote:
>> 
>> My code calls -[NSArray objectAtIndex:]. I compile it with Xcode 5.0.2 on OS 
>> X 10.9.x Mavericks in a project with the target's Base SDK set to 10.9 and 
>> the OS X Deployment Target set to OS X 10.7. It works fine when I run it on 
>> OS X 10.9 or OS X 10.8.
>> 
>> However, when I run it on Mac OS X 10.7 Lion, I get a runtime error claiming 
>> it encountered an invalid argument, namely, the unrecognized selector 
>> -objectAtIndexedSubscript:. The NSArray Class Reference notes that 
>> -objectAtIndexedSubscript: is available only in OS X 10.8 and later, and 
>> that it is "identical to objectAtIndex:". Of course, -objectAtIndex: still 
>> exists in the 10.9 API, and it is not marked as deprecated.
>> 
>> It appears, therefore, that the compiler generated a call to 
>> -objectAtIndexedSubscript: even though my source specifies -objectAtIndex: 
>> and a deployment version of 10.7.
>> 
>> Has anyone else encountered this? -- I don't find anything in my searches. 
>> It seems like a serious bug that would have cropped up for practically 
>> everybody.
> 
> -objectAtIndexedSubscript: is what the compiler generates when it sees 
> square-bracket indexing syntax applied to an NSArray:
> 
>  NSArray *a = …;
>  foo(a[0]); // generates call to -objectAtIndexedSubscript:
> 
> It’s unfortunate that the compiler doesn’t catch that you’re targeting 10.7, 
> where this method does not exist, and prevent such syntax.

The arclite glue library is supposed to add that method at runtime if it does 
not exist. 

Perhaps arclite is not being linked in somehow? The machinery for linking 
arclite is complicated and I forget what it is supposed to look like in your 
build transcript.


Aaron Tuller wrote:
> According to this:
> 
> https://developer.apple.com/library/mac/releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html
> 
> subscripting works back to 10.6 and requires the modern runtime. Is this by 
> any chance a 32-bit app?

Object subscripting is supposed to be a compiler error on 32-bit Mac. 


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to