我有一个 strange 问题(至少对我来说是这样),我的NSMutableArray似乎认为objectAtIndex:1
显然不存在时,认为UITableView cellForRowAtIndexPath
不存在控制台输出。
我提供了数组和冲突代码。
请注意,这是在-- Interface
@property (nonatomic, strong) NSMutableArray *packages;
-- viewDidLoad
packages = [[NSMutableArray alloc] init];
NSMutableArray *package1 = [[NSMutableArray alloc] init];
[package1 addObject:@[@"iPhone Cases", @"9928898669"]];
[packages addObject:package1];
NSMutableArray *package2 = [[NSMutableArray alloc] init];
[package2 addObject:@[@"RGB Controller", @"33A4Q0446691"]];
[packages addObject:package2];
NSLog(@"Packages Array: %@", packages);
-- UITableViewCell
NSMutableArray *package = [packages objectAtIndex:indexPath.row];
NSLog(@"%@", package);
NSString *packageName = [NSString stringWithFormat:@"%@", [package objectAtIndex:0]];
NSString *trackingNumber = [NSString stringWithFormat:@"%@", [package objectAtIndex:1]];
cell.appName.text = packageName;
cell.appVersion.text = trackingNumber;
-- Console Output
2019-03-14 19:45:35.942580+1100 SilentParcel[28937:961776] Packages Array: (
(
(
"iPhone Cases",
9928898669
)
),
(
(
"RGB Controller",
33A4Q0446691
)
)
)
2019-03-14 19:45:35.975358+1100 SilentParcel[28937:961776] (
(
"iPhone Cases",
9928898669
)
)
{{1}}
答案 0 :(得分:0)
感谢此评论(NSRangeException for NSMutableArray regarding objectAtIndex: 0)
我的问题已解决。我仍然不知道为什么或如何解决此问题,但确实如此。所以谢谢@Larme