views:

95

answers:

1

After a bit of time searching and commenting out my code, I've discovered that UIDatePickerModeDateAndTime leaks while UIDatePickerModeDate doesn't - however, I need to be able to set date and time via a picker so I need ...DateAndTime. What's odd is that any other problem that I've encountered, I've Googled it and usually found references to the problem including what I was doing wrong, but I can find no mention of this one - which makes me wonder.

Whereas the same code with UIDatePickerModeDate produces zero leaks, UIDatePickerModeDateAndTime leaks 640 bytes when the picker first shows up on the screen and 256 bytes each time the date picker is turned. Also when a datepicker.date property is encountered, also only while using UIDatePickerModeDateAndTime, it appears that another 128 bytes are leaked.

Realistically with my app, if used properly, it would be rare that even 5K bytes would be leaked from this screen.

Is this something that I should be worried about in terms the app being rejected? Should I look into using 2 pickers, one for date and another for time?

Any advice appreciated. Not that there's much to see but here's some code...

// Initialization code for datePicker
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 480, 325, 250)];
datePicker.datePickerMode = UIDatePickerModeDateAndTime; //...DateAndTime leaks, ...Date alone doesn't
datePicker.minuteInterval = 15;
datePicker.hidden = NO;
[datePicker addTarget:self action:@selector(changeDate:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:datePicker];
A: 

In the end, if Apple decided to reject the app - which they probably wouldn't do but could, how exactly would I argue with them? "This leak is your fault?" No, this is my app and this leak is my fault for using a leaky component.

I ended up using a date picker AND a time picker instead of the DateAndTime picker.

Not a single leak!

Matt Winters