问题描述:想计算某一段代码的执行时间,加了下面的代码:
NSDate *startTime;
startTime = [NSDate date];
NSLog(@"Time: %f", -[startTime timeIntervalSinceNow]);
结果报错如下:
[__NSCFString timeIntervalSinceNow]: unrecognized selector set to instance
问题原因很简单,因为startTime没有retain
问题描述:想计算某一段代码的执行时间,加了下面的代码:
NSDate *startTime;
startTime = [NSDate date];
NSLog(@"Time: %f", -[startTime timeIntervalSinceNow]);
结果报错如下:
[__NSCFString timeIntervalSinceNow]: unrecognized selector set to instance
问题原因很简单,因为startTime没有retain
转载于:https://my.oschina.net/ioslighter/blog/387047