3

我已经对这个进行了广泛的搜索,但我不确定发生了什么。我在我的项目中添加了一个新的 ViewController 并将一个连接UILabel到情节提要文件并为其分配了新的自定义类。它是完全空白的,不执行任何操作,但在此行加载时崩溃:

UIKit`-[UINibDecoder validateAndIndexKeys:length:]

我有另一个 ViewController 以完全相同的方式设置,它工作正常。我一定在这里遗漏了一些东西。我尝试清理和构建,甚至尝试完全重建,包括UIViewController在情节提要上删除和制作新内容。我发现一旦我UILabel从代码中删除它,它就可以正常加载。这是我的代码:

@interface GoalDetailViewController : UIViewController

@property (nonatomic, strong) IBOutlet UILabel *goalLabel;
@property (nonatomic, strong) NSString *goal;

@end

#import "GoalDetailViewController.h"

@implementation GoalDetailViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view.

    // nameLabel.text = name;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
4

0 回答 0