I had an application which was working fine till iOS 5.1. But recently with iOS 6 it has started giving crash when I try to select a row in a component programmatically. Following is my code:
UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 320, 216)];
pickerView.delegate=self;
pickerView.dataSource=self;
pickerView.showsSelectionIndicator=YES;
[pickerView setTag:10];
//[pickerView selectRow:0 inComponent:0 animated:YES];
int index1 = [arrHours indexOfObject:[arrTitle objectAtIndex:0]];
int index2 = [arrMins indexOfObject:[arrTitle objectAtIndex:1]];
[actionSheet addSubview:pickerView];
[pickerView selectRow:index1 inComponent:0 animated:YES];
[pickerView selectRow:index2 inComponent:1 animated:YES];
[pickerView release];
It runs fine when I try to select row in component 0 but I get crash when I try to select row in component 1.
ok found the error on debugging. The problem was because of 00 in the data. Earlier framework was converting it to 0 by itself but in new sdk (ios6) it started producing error when I was considering 00 as 0.