0

现在我确定我在这里做了一些非常小学生的事情,但是我严重地将我的头撞到了墙上,由于某种原因,我在尝试在自定义类上设置 NSNumber 属性时得到了 EXEC_BAD_ACCESS。想想我有那些日子!

这是我的测试 h 和 m 文件:

//  Test.h

#import <Foundation/Foundation.h>


@interface Test : NSObject {
    NSNumber *myId;
}

@property (nonatomic) NSNumber *myId;

@end


//  Test.m

#import "Test.h"


@implementation Test

@synthesize myId;

@end

我的测试很简单:

Test *test = [[Test alloc] init];
test.myId = 1;
4

1 回答 1

3
test.myId = [NSNumber numberWithInt:1];
于 2010-07-15T16:43:48.627 回答