Ios 获取SIGABRT错误

Ios 获取SIGABRT错误,ios,uitableview,sigabrt,Ios,Uitableview,Sigabrt,我在main中遇到SIGABRT错误。m: #import <UIKit/UIKit.h> #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); // SIGABRT error }

我在main中遇到SIGABRT错误。m:

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); // SIGABRT error
    }
}
这是TableViewController.m文件:

@implementation TableViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSDictionary *blogPost1 = [NSDictionary dictionaryWithObjectsAndKeys:@"The Missing Widget in Android", @"title", @"Ben Jakuben", @"author", nil];

     NSDictionary *blogPost2 = [NSDictionary dictionaryWithObjectsAndKeys:@"Getting Started with iOS Development", @"title", @"Amit Bijlani", @"author", nil];

     NSDictionary *blogPost3 = [NSDictionary dictionaryWithObjectsAndKeys:@"An Interview with Shay Howe", @"title", @"Joe Villanueva", @"author", nil];


    self.blogPosts = [NSArray arrayWithObjects:blogPost1, blogPost2, blogPost3, nil];

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    // Configure the cell...
    cell.textLabel.text = [self.blogPosts objectAtIndex:indexPath.row];

    return cell;
}

@end

您正在将
NSDictionary
实例存储在
self.blogPosts
中,但随后存储在

cell.textLabel.text = [self.blogPosts objectAtIndex:indexPath.row];
您正在将其中一个字符串分配给
文本
,这需要一个
NSString
。编译器没有捕获它,因为
objectAtIndex:
返回类型为
id
的对象,该对象可能是任何对象

一个可能的解决方案(但这实际上取决于你需要什么)可能是


好的,但是在哪里?我一直在Xcode中使用文本搜索查找“长度”,但找不到它。我已经编辑了我的答案,
length
可能是由单元格内部调用的。谢谢,我找到了问题。他丢失了一份声明。
cell.textLabel.text = [self.blogPosts objectAtIndex:indexPath.row];
cell.textLabel.text = self.blogPosts[indexPath.row][@"title"];