Xcode:+[NSTimer scheduledTimerWi
2017-04-27 本文已影响211人
PZcoder
问题描述:
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;
试了一下可以了,最后总结一句,还是用真机调试比较方便。。。