当我尝试构建和运行时,Xcode表示我的设备已被锁定.我看了看我的iPhone,它根本没有锁定......可能的错误?我该如何解决?
这就是我目前在WatchKit中填充表视图的方式:
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
// Configure interface objects here.
menuItems = [[NSMutableArray alloc] initWithObjects:@"Pizza", @"Chicken", @"Bread", nil];
for (NSString *item in menuItems)
{
MenuRowController *menuRow = [myTableView rowControllerAtIndex:[menuItems indexOfObject:item]];
[menuRow.menuItemLabel setText:item];
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Extension[980:19597] Error - attempt to ask for row 0. Valid range is 0..0
Printing description of item:
Pizza
2015-07-05 01:58:07.284 ScanBarWatch WatchKit Extension[980:19597] Error - attempt to ask for row 1. Valid range is 0..0
2015-07-05 01:58:14.780 ScanBarWatch WatchKit Extension[980:19597] Error - attempt to …Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码将数据传递给我的第三个控制器:
[self presentControllerWithName:@"ThirdView" context:MyArray];
Run Code Online (Sandbox Code Playgroud)
问题是,我想传递的不仅仅是一个简单的数组.我想传递一个单独的字符串,如果可能的话,另一个数组,我不想将字符串或其他数组添加到"MyArray".
有没有不同的方法来解决这个问题,或者我只是重构这个代码?