一个简单的测试 -
- (void)viewDidLoad
{
[super viewDidLoad];
NSDate *date1 = [NSDate date];
NSDate *date2 = [NSDate dateWithTimeIntervalSinceNow:3];
NSTimeInterval timeBetween = [date1 timeIntervalSinceDate:date2];
NSLog(@"between: %@",timeBetween);
}
在“NSTimeInterval ...”
行中出现错误程序接收信号: 'EXC_BAD_ACCESS'
你能告诉我哪里出错吗?
答案 0 :(得分:0)
您在NSLog语句中使用字符串格式代码而不是数字格式代码。尝试:
NSLog(@"between: %f",timeBetween);