NSDate initWithString

爷,独闯天下 提交于 2019-12-02 02:19:43

This method is in the documentation only noted at the Mac OSX page, not the iOS. Why Apple has different versions is unclear to me, but they luckily respond the same.

Because the class reference for iOS says there is no such method for iOS NSDate, you get the warning. Your code, however, will respond perfectly fine.

To silence the warning, you should indeed use NSDateFormatter.

Regards,

Jacco

You should use NSDateFormatter to get an NSDate object from a string. This will give you more flexibility with the format of the input string.

NSDateFormatter Reference

Read the changes at this website http://developer.apple.com/library/ios/#releasenotes/General/iOS42APIDiffs/index.html Sometimes they change little syntax things and make newer and better ways of doing things.

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