我有一个视图需要等到从 Web 服务检索到数据然后更新 UI 选择器视图。如果用户滚动选择器视图,我正在等待响应,应用程序崩溃并且我收到 lldb 错误。有什么理由吗?
这是我的代码:
@interface LocavoreRetroSecondViewController ()
@end
@implementation LocavoreRetroSecondViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"I Ate Local", @"I Ate Local");
self.tabBarItem.image = [UIImage imageNamed:@"newfood"];
_dataController = [[InSeasonProductDataController alloc] init];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return [_dataController countOfList];
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
Product *product = [_dataController objectInListAtIndex:row];
return product.name;
}
- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
//do something
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc{
[_dataController release];
[super dealloc];
}
我收到此错误:
* -[UITableViewRowData rectForRow:inSection:], /SourceCache/UIKit_Sim/UIKit-2380.17/UITableViewRowData.m:1630 (lldb) 中的断言失败