美文网首页iOS之报错上架填坑
Xcode:+[NSTimer scheduledTimerWi

Xcode:+[NSTimer scheduledTimerWi

作者: PZcoder | 来源:发表于2017-04-27 14:43 被阅读211次

问题描述:

Xcode8.1 在使用5S/6 系统8或9时会崩溃,报以下错误:
+[NSTimer scheduledTimerWithTimeInterval:repeats:block:]: unrecognized selector sent to class 0x1a15

原因分析:

搞了 半天,发现是个低智商错误:
+[NSTimer scheduledTimerWithTimeInterval:repeats:block:]这个方法在iOS10系统才开始使用,老版本不兼容。

解决方法:

应该改成:+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullable id)userInfo repeats:(BOOL)yesOrNo;

试了一下可以了,最后总结一句,还是用真机调试比较方便。。。

相关文章

网友评论

    本文标题:Xcode:+[NSTimer scheduledTimerWi

    本文链接:https://www.haomeiwen.com/subject/ksagzttx.html