pickerView を実行しようとしていますが、アクセスがうまくいきません:
ここに私のコードがあります
-(void) viewWillAppear:(BOOL)animated {
list = [[NSArray alloc]init];
[self populateList]
}
-(void) populateList {
NSString *path = [[NSBundle mainBundle] pathForResource:@"nameoffile" ofType:@"txt"];
NSString *file = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
list = [file componentsSeparatedByString:@"\n"];
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return (NSString *)[list objectAtIndex:row]; //here I'm getting bad acces
}
エラーは次のとおりです。「スレッド 1: EXC_BAD_ACCESS(コード = 1、アドレス = 0xa001cc65)」