开发者

Unable to set class properties

Now Im sure Im doing something extremely schoolboy here, but Im seriously hitting my head against a wall, for some reason Im getting EXEC_BAD_ACCESS when trying to set an NSNumber property on a custom class. Think Im having one开发者_开发百科 of those days!

Here my test h and m files:

//  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

My test is simply:

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


test.myId = [NSNumber numberWithInt:1];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜