iPhone OS 上的 NSDate dateByAddingTimeInterval 在哪里?
问候!我一定是看到了一些东西。看看这个 摘自 iPhone 操作系统 参考库:
addTimeInterval:返回一个新的 NSDate 设置为给定数字的对象 相对于接收器的秒数。 (已弃用。此方法已被 dateByAddingTimeInterval: 取代。)
但是,在文档中或标头中都找不到它。如果我查看 Mac OS SDK,那么我就能找到它。
打字错误?毕竟继续使用 addTimeInterval: 吗?
Greetings! I must be seeing things. Look at this excerpt from the iPhone OS reference library:
addTimeInterval: Returns a new NSDate
object that is set to a given number
of seconds relative to the receiver.
(Deprecated. This method has been replaced by dateByAddingTimeInterval:.)
However, it is nowhere to be found in the docs, nor in the headers. If I look at the Mac OS SDK, then I find it.
Typo? Just keep using addTimeInterval: after all??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这实际上是文档中的错误。
addTimeInterval:
在 Mac OS X 10.6 中已弃用,但在 iPhone OS 3.1.2 中并未弃用。您可以查看 MacOS 和 iPhoneOS 中的 NSDate.h,您会发现差异。
iPhone OS 中的 NSDate.h
和 Mac OS 10.6 中的 NSDate.h
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
and NSDate.h in Mac OS 10.6
对我来说似乎是一个错字,因为我在我的系统上看到的内容与您相同。也许他们打算弃用所描述的方法,但在最后一刻将其删除,不正确的文本仍然存在。
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 现已在 iOS 4 中弃用。
addTimeInterval is now deprecated in iOS 4.