__NSCFString timeIntervalSinceReferenceDate]: unrecognized selector sent to instance

You are sending String data where NSDate is required. type mismatch is leading to crash your application. You must convert your string into Date before using your function, Here is how you can convert.

NSString *dateStr = @"2016/12/20 12:53:58 +0000";
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy/MM/dd HH:mm:ss Z"];
NSDate *date = [dateFormat dateFromString:dateStr];

Note: yyyy/MM/dd HH:mm:ss Z is the date format i have used to show example, you have change this format as per your string.

//date is what you need to pass,

You have to do this for both your date,


Try this one:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];

NSString *startStr = @"2016-10-05 10:20:00 +0000";
NSString *endStr = @"2016-10-05 10:25:00 +0000";
NSDate *startTime = [dateFormatter dateFromString:startStr]; //[currentRecord valueForKey:@"starttime"];
NSDate *endTime = [dateFormatter dateFromString:endStr]; //[currentRecord valueForKey:@"endtime"];

NSTimeInterval secondsBetween = [endTime timeIntervalSinceDate:startTime];
NSLog(@"deference :%f",secondsBetween);