这是什么意思?我该如何解决?
代码:
- (id)init
{
[super init];
firstNumber = random() % 100 + 1;
secondNumber = random() % 100 + 1;
return self;
}
错误:
/Users/user/Dropbox/dev/bignerdranch_cocoa/lottery/LotteryEntry.m:15:5:{15:5-15:17}: error: the result of a delegate init call must be immediately returned or assigned to 'self' [4]
答案 0 :(得分:23)
您的self
未创建...
-(id) init {
self = [super init];
if(self != nil) {
// do init stuff
}
return self;
}