Objective-C & Compare two NSStrings
I am trying to compare 2 NSStrings to see if they match but my app keeps crashing with a EXC_BAD_ACCESS and it just shows me an assembly output and not the actually location within my code that it keeps crashing.
Here is my compare:
NSString *compareAlarm = [lblTime stringValue];
[lblTime setStringValue:[self getTime]];
if ([sAlarmTime isEqualToString:compar开发者_StackOverflow中文版eAlarm])
{
NSLog(@"Alarm Hit");
}
[compareAlarm release];
Does anyone see why this would fail? If I comment out the if statement the crash stops.
Thanks in advanced.
you aren't retaining compareAlarm
but you release it.
精彩评论