Search code examples
iosios6uipickerviewupgrade

UIPickerView selectrow crash in iOS 6


My application build & run in iOS 5.x perfectly, but it crashes when I call selectRow:inComponent:animated: method of UIPickerView in iOS 6.

code :

[_pickerview selectRow:1 inComponent:0 animated:NO];

I know this method is not work in iOS6 when I googled it, but I want to know other method to do this effect?


Solution

  • Your crash log says you have used a -1 in code where should be a number in range {0, 1}. But in the the code you paste you indeed use 1. So you need to check your parameter for your xxx and yyy

    pickerView.selectRow(xxx, inComponent: yyy, animated: false)