iPhone iOS 4 addTimeInterval 已弃用
我正在使用 addTimeInterval
创建本地通知,但似乎它现在已被弃用(iOS 4)。
我的代码:
localNotif.fireDate = [now addTimeInterval:timeInterval];
Xcode 的警告:
'addTimeInterval:' is deprecated (declared at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSDate.h:27)
我应该使用什么代替? 谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该方法已重命名为
-dateByAddingTimeInterval:
。在 Swift 2.2 中:
在 Swift 3 中:
The method has been renamed to
-dateByAddingTimeInterval:
.In Swift 2.2:
In Swift 3:
尝试一下:
try that: