Whither NSDate dateByAddingTimeInterval on iPhone OS?

帅比萌擦擦* 提交于 2019-12-05 11:23:42

It's actually an error in the docs. addTimeInterval: is deprecated in Mac OS X 10.6 but not in iPhone OS 3.1.2.

You can look at the NSDate.h in MacOS and in iPhoneOS and you'll see the difference.

NSDate.h in iPhone OS

- (id)addTimeInterval:(NSTimeInterval)seconds;

and NSDate.h in Mac OS 10.6

- (id)addTimeInterval:(NSTimeInterval)seconds DEPRECATED_IN_MAC_OS_X_VERSION_10_6_AND_LATER;
- (id)dateByAddingTimeInterval:(NSTimeInterval)ti AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;

Looks like a typo to me as I see the same thing on my system as you do. Perhaps they intended to deprecate the method as described but cut it at the last minute, with the incorrect text still in place.

addTimeInterval is now deprecated in iOS 4.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!