开发者

Objective-C & Compare two NSStrings

开发者 https://www.devze.com 2023-02-24 02:03 出处:网络
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 kee

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消