a simple test--
- (void)viewDidLoad
{
[super viewDidLoad]开发者_开发问答;
NSDate *date1 = [NSDate date];
NSDate *date2 = [NSDate dateWithTimeIntervalSinceNow:3];
NSTimeInterval timeBetween = [date1 timeIntervalSinceDate:date2];
NSLog(@"between: %@",timeBetween);
}
It got an error in line "NSTimeInterval..."
program received signal: 'EXC_BAD_ACCESS'
Would you tell me where is wrong?
you're using a string format code instead of a number format code in your NSLog statement. try:
NSLog(@"between: %f",timeBetween);
精彩评论