UIPickerView
每当通过调用此方法选择一行时,我都会将对象添加到可变数组中-
-(void)setScheduleStartDate:(NSString *)dateStr
{
[scheduleDatesArray removeAllObjects];
NSDateFormatter* df = [[NSDateFormatter alloc] init];
df.dateFormat = @"d MMMM yyyy";
scheduleStartDate = [df dateFromString:dateStr];
/******* getting array of schedule dates ***********/
NSDate* scheduleEndDate = [scheduleStartDate dateByAddingTimeInterval:60*60*24*28*6]; // add six month (of 28 days) in schedule start date
double endMS = [scheduleEndDate timeIntervalSinceDate:scheduleStartDate];
for (double i =0; i < endMS; i = (i + 60*60*24*14)) {
[scheduleDatesArray addObject:[NSNumber numberWithDouble:i]];
}
}
多次调用此方法后,我崩溃并显示此错误消息
malloc: *** mmap(size=627101696) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
通过在我的应用程序中设置断点malloc_error_break
中断 for 循环(我将对象添加到数组中)。但是我找不到问题,我在谷歌上搜索过同样的问题,但仍然没有运气。
谁能帮助我做错了什么?