私はこれらの奇妙なエラーを取得していますが、私はそれらを理解していません。ここでのエラーは、次のとおりです。誰かが私にこれらのエラーを説明することはできますか?
error: variable - sized object may not be initialized (#1)
error: statically allocated instance of Objective-C class 'Joke' (#1)
error: statically allocated instance of Objective-C class 'Joke' (#1)
error: cannot convert to a pointer type (# 2)
(注:エラーが私の実装ファイルであったところ、エラーの後に番号が表示されます)ここで
は私の.mファイルです:
#import "Joke.h"
@implementation Joke
@synthesize joke;
@synthesize rating;
- (id)init {
[super init];
return self;
}
- (void)dealloc {
[joke release];
[super dealloc];
}
+ (id)jokeWithValue:(NSString *)joke {
Joke j = [[Joke alloc] init]; // (# 1) This is where #1 errors occurred
j.joke = joke;
return [j autorelease]; // (# 2) This is where #2 errors occurred
}
@synthesize joke;
@synthesize rating;
@end
感謝!
Ahhhありがとう!あなたのアプリが失敗する原因になることが少し奇妙なので、奇妙な! –
本当に変です。ジェイソンの答えを見てください。 –