我是 iPhone 的新手。我有一个问题。首先检查我的代码。
NSString *timeZone=[NSString stringWithFormat:@"%@",[[NSTimeZone systemTimeZone] abbreviation]];
NSLog(@"Print Time Zone :- '%@'",timeZone);
NSRange Timerange=[timeZone rangeOfString:@"+"];
NSString *time;
if(Timerange.location == NSNotFound)
{
Timerange=[timeZone rangeOfString:@"-"];
time=[timeZone substringFromIndex:Timerange.location];
NSLog(@"Time is :- '%@'",time);
time=[time stringByReplacingOccurrencesOfString:@"-" withString:@"M"];
}
else
{
Timerange=[timeZone rangeOfString:@"+"];
time=[timeZone substringFromIndex:Timerange.location];
NSLog(@"Time is :- '%@'",time);
time=[time stringByReplacingOccurrencesOfString:@"+" withString:@"P"];
}
它在 iPhone 模拟器 4.2 中正常工作,但在模拟器 4.3 中崩溃,那么可能是什么问题?
谢谢