这是arrayOfPerformances被打破。为什么NSMutableArray在这个循环中被破坏?
这里是数组的.H:
NSMutableArray * arrayOfPerformances;
}
@property (nonatomic, retain) NSMutableArray * arrayOfPerformances;
,并具有循环中的m:
[dataArray release];
[dataDictionary release];
dataArray = [[NSMutableArray alloc] init];
dataDictionary = [[NSMutableDictionary alloc] init];
NSDate * CurrentDate = start;
int i = 0;
NSMutableArray * arrayOfPerformancesForCurrentDate = [[NSMutableArray alloc] init];
while(YES)
{
i = 0;
if ([arrayOfPerformancesForCurrentDate count] > 0)
{
[arrayOfPerformancesForCurrentDate removeAllObjects];
}
for (i; i < self.arrayOfPerformances.count; i++)
{
Performance * performanceItem = [[Performance alloc] init];
performanceItem = [self.arrayOfPerformances objectAtIndex:i];
NSString * sPerformanceDate = [performanceItem.sDate substringToIndex:10];
NSString * sCurrentDate = [CurrentDate dateDescription];
if([sPerformanceDate isEqualToString:sCurrentDate])
{
[arrayOfPerformancesForCurrentDate addObject:performanceItem];
}
[performanceItem release];
}
if ([arrayOfPerformancesForCurrentDate count] >= 1)
{
[dataDictionary setObject:arrayOfPerformancesForCurrentDate forKey:CurrentDate];
[dataArray addObject:[NSNumber numberWithBool:YES]];
}
else
{
[dataArray addObject:[NSNumber numberWithBool:NO]];
}
TKDateInformation info = [CurrentDate dateInformation];
info.day++;
CurrentDate = [NSDate dateFromDateInformation:info];
if([CurrentDate compare:end]==NSOrderedDescending) break;
}
任何帮助,将不胜感激。我不明白为什么会发生这种情况?
干杯,工作。我不知道为什么我分配和初始化Performance类,出于某种原因,我认为我必须为init分配一个空白的性能,以便为它分配一个已经创建的对象。谢谢! – Mausimo 2010-11-17 06:23:59