我在 iOS8 上的 Today Extensions 中有一些问题。我尝试使用 Xcode Debugger 和放置 nslogs 进行调试。我的代码中也没有逻辑。由于某些原因:
- 该小部件不显示任何数据(仅适用于 Hello World 标签)
- 调试不起作用,它没有达到任何断点。是否有任何特定的方式来调试扩展?
这是我的代码片段
@implementation TodayViewController{
NSArray *localList;
}
-(void)awakeFromNib{
[super awakeFromNib];
[self loadList];
[self setPreferredContentSize:self.tableView.frame.size];
NSLog(@"inside awake from nib");
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"inside view did load");
}
-(void)loadList{
NSMutableArray *mutableArray = [[NSMutableArray alloc]initWithCapacity:5];
[mutableArray addObject:@"asdjasdj"];
[mutableArray addObject:@"qowiepqiw"];
[mutableArray addObject:@"qoqwoei"];
[mutableArray addObject:@"pqoiweoqi"];
[mutableArray addObject:@"lkdsflk"];
[mutableArray addObject:@"kdjlkaj"];
localList = [mutableArray copy];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [localList count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"WidgetCell"];
UILabel *label = [[UILabel alloc]init];
[label setText:[localList objectAtIndex:indexPath.row ]];
[[cell contentView]addSubview:label];
return cell;
}