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.
My actual code is this:
NSString *rootPath =
[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask,
YES) objectAtIndex:0];
I could try casting the result of NSSearchPathForDirectoriesInDomains() to type
NSArray* or break this statement into two parts with an intermediate NSArray
local variable, but I can't see why that would make any difference.
Is there any way to work around this?
I notice that the 10.7 Lion SDK is not part of the Xcode 5 installation. Do I
have to add the 10.7 Lion SDK? -- and how would I go about doing that?
--
Bill Cheeseman - [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]