我的代码中出现上述错误,但我不知道如何解决,请帮我解决。
我已经提供了该代码。
NSMutableDictionary *dictNewHour = [[NSMutableDictionary alloc]init];
if (_datedetailsArray.count > 0){
for (int i = 0; i < _datedetailsArray.count; i++){
if ([[_datedetailsArray[i] valueForKey:@"totalhours"] isEqualToString:@"4"]) -----> **In this line I have that error**{
NSString *new4Hour = [NSString stringWithFormat:@"%@, %@",[_datedetailsArray[i] valueForKey:@"totalhours"],fourOnly];
[dictNewHour setObject:new4Hour forKey:@"totalhours"];
[fourHoursArray addObject:dictNewHour];
NSLog(@"fourHoursArray is:%@",fourHoursArray);
NSLog(@"fourHoursArray count is:%lu",(unsigned long)fourHoursArray.count);
append4String = [NSString stringWithFormat: @"%@ %lu %@", hr4String, (unsigned long)fourHoursArray.count, daysString];
NSLog(@"append4String is:%@",append4String);
}
答案 0 :(得分:0)
&#34; isEqualToString&#34;是NSString类方法,您正在使用NSArray对象访问此方法所以请检查数据