- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
由于某种原因,加载此 View 时我收到上述错误。相同的代码适用于在我之前的 View 中填充 tableView 行,因此我不知道这会出现什么问题 - 这是完全相同的代码。当我转换到此 View 时,应用程序崩溃了。它在正确崩溃之前成功地 NSLog self.tableRows 中的类别,因此 tableRows 中的存储似乎不是问题。它在计算行数的行上崩溃(返回 self.tableRows.count)。我感觉这个错误与无法访问 tableRows 有关,但我对 iOS 很陌生。感谢您的帮助!这是我即将到期的大学类(class)项目,因此我们将不胜感激。
#import "DivisionsViewController.h"
#import "TeamsViewController.h"
@implementation DivisionsViewController
@synthesize tableRows = _tableRows;
@synthesize currentKey = _currentKey;
NSMutableArray* temp;
#pragma mark - Table view data source
- (void)viewDidLoad
{
[super viewDidLoad];
_currentKey = @"default";
//temporary- trying to populate TableView from JSON
int i = -1;
self.tableRows = [NSMutableArray array];
temp = [[NSMutableArray alloc] init];
for(NSDictionary *dict in self.divisions){
NSString *category = [dict objectForKey:@"category"];
if (self.currentKey != category){
[self.tableRows addObject:category];
[temp addObject:[[NSMutableArray alloc] init]];
self.currentKey = category;
NSLog(@"table value %@", [self.tableRows lastObject]);
i++;
}
[[temp objectAtIndex:i] addObject:dict];
}
for (NSString* category in self.tableRows){
NSLog(@"category: %@", category);
}
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.tableRows.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DivisionCell" forIndexPath:indexPath];
cell.textLabel.text = [self.tableRows objectAtIndex:indexPath.row];
return cell;
}
最佳答案
您是否尝试过 NSLog 您的表行数?尝试在返回 numberOfRows 之前对其进行 NSlog。
self.tableRows.count
您还可以尝试设置异常断点。在 xcode 中选择“断点导航器” - 它是选项卡右侧的第二个选项卡。(您可以在最左侧的选项卡中查看您的项目)当您位于该选项卡中时,您可以按左下角的 + -> 添加异常断点。然后它在崩溃之前就中断了 - 可能很有用!
关于objective-c - 填充 iOS TableView-EXC BAD_ACCESS 代码 = 1 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13758348/
当我从 EKEvent 访问生日ContactIdentifier 属性时,我总是立即收到 BAD_ACCESS 错误(甚至无法进行 nil 检查) 这是我用来获取的代码 import UIKit
我有 A 类和 B 类。我正在从 A 类调用 B 类。这里我的问题是 A 类的宽度和高度取决于 B 类。当 sizeForScrollView 属性(B 类属性)更改时我想要通知。一切正常。但是当我当
我正在从 ARKit 捕获一帧并从中获取 CVPixelBuffer func session(_ session: ARSession, didUpdate frame: ARFrame) {
我想保留我的风景。为此,我正在使用此代码,但 BAD_ACCESS 即将到来。在这里,我正在为相机 overlayView 编写这段代码。 -(void)viewDidLoad { [[
当我尝试使用我在 iPhone 开发中从本地 SQLITE 数据库中选择的值执行任何操作时,我收到 EXC_BAD_ACCESS。我的功能代码是 -(void) updateFromDB { // S
我用 Xcode 编写。我的代码应该将文本文件逐行读取到指针数组 *ar[] 中。我使用了一个简单的循环,通过 getc() 将每个字符读取到 c,并将 c 读取到 *ar[i]。如果 c!= '\n
我在 Xcode 7.3 上的 Swift 2.2 中发现了一个奇怪的错误(或者这不是错误但我做错了什么)。 我有一个枚举,其中一个案例和类将此枚举作为初始化程序的参数 enum OneCaseEnu
我正在浏览一个可变参数列表,当我到达列表中的最后一个对象时,我总是会收到 BAD_ACCESS 错误。我强烈认为它是 ARC相关问题。 这是我的做法: -(NSString *)replaceToke
我有一个由 NSFetchedResultsController 提供的 UITableViewController。 一切正常,直到我添加 if (self.fetchedResultsContro
好吧,我完全不知所措了。一小部分用户在我的主机名翻译中似乎存在 BAD_ACCESS 错误。 完整的崩溃如下: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Ex
由于某种原因,我的应用程序崩溃了,我不确定是什么原因导致了问题,除了它似乎与处理文件时跨越的调度队列有关。任何帮助将不胜感激。 Crashed Thread: 0 Dispatch queue:
这听起来可能是个新手问题,但我是 iOS 开发新手, 最近我切换到 ARC 并在我的代码中遇到以下问题。我已经使用以下 init 方法实现了一个类 - (id)init { self = [s
下面是我上传日志文件到FTP的代码,问题是有时执行[mInputStream open]时会崩溃。 XCode 显示 BAD_ACCESS。我猜这可能是由于上传大文件造成的。然而,即使文件很小,有时也
我正在尝试像这样实例化 UiAlertView: UIAlertView *alert = [[UIAlertView alloc]
我在使用异步调度时遇到了一个非常奇怪的错误访问错误。我设法将其减少到程序中的这段代码。 -(void)buttonTapped:(id)sender { __block NSArray*foo
我有一个属性(noARC) @property (nonatomic, retain) NSString *itemUUID; 和一个初始化 - (void) viewDidAppear:(BOOL)
我在子类 UIImageview 中有一个 CGMutablePathRef 属性。当我创建新路径并将其分配给属性时,CGPathRelease 在我调用 CGPathContainsPoint 时会
在运行时循环两次,在通过请求查询调用 PrepareStatement 时因 Bad_Access 而崩溃。 所以我检查了所有的 ResultSet 内存并释放了它但是没有想法有什么办法可以解决这个问
也许我不打算使用 CoreData 显示选定行的详细信息,但我无法弄清楚为什么我会收到“BAD_ACCESS”错误。我用谷歌搜索,找不到我要找的东西。 基本上,我使用 CoreData 来填充 Tab
我有一个带有 3 个 View Controller 的应用程序,它们被推送到导航 Controller 堆栈上。 (A) -> (B) -> (C) (A) 在 viewWillAppear 中注册
我是一名优秀的程序员,十分优秀!