Reputation: 930
In Xcode 6, the document of some functions declares that the availability of the function is iOS 8 and later, but in fact that function exists before iOS 8 as well.
For example, the doc of -[NSMutableURLRequest setHTTPBody]
in Xcode 6 is like this:
However, in Xcode 5, it is like this:
This confused me, as all I want to do is to use setHTTPBody
and make sure it does not crash my app before iOS 8. In this case, although the doc of Xcode 6 says it is "iOS 8 only", in fact it is not, my time is wasted double checking its availability.
For some time, whenever I see some "iOS 8 only" functions like this in the document in Xcode 6, I still have to double check, and most of the time they exist before iOS 8. So how can I overcome this issue?
Upvotes: 3
Views: 204
Reputation: 33369
The complier generates slightly different binary code for properties, so these two lines of code are different:
request.HTTPBody = foo;
[request setHTTPBody:foo];
The differences are subtle, but I would use the latter if your app runs on iOS 7.
As for what you should do about it, file a bug with Apple: https://developer.apple.com/bug-reporting/ — be sure to select Documentation as the product you're reporting a bug on.
Upvotes: 2
Reputation: 107211
From the documentation itself you can clearly see that:
Prior to iOS 8:
There is a custom setter for setting the HTTPBody
property. The property itself was private.
- (void)setHTTPBody:(NSData *)data;
In iOS 8:
HTTPBody
is a public property.
@property (copy) NSData *HTTPBody;
Upvotes: 1