0

このコードがBadAccessの例外をスローしている理由がわかりません。

- (void)viewDidLoad
{

TheUserEntity* userEntity = [TheUserEntity alloc];

TheUserModel* userModel = [TheUserModel alloc];

userEntity = [userModel Read:1];

    [super viewDidLoad];
}

TheUserEntityとTheUserModelは私自身のクラスであり、1にはプロパティのみがあり、他にはCRUDメソッドのみがあります

何か助けはありますか?私はiOS開発の初心者です、ありがとう

4

1 に答える 1

3

オブジェクトを呼び出す必要がありinitます。

TheUserEntity* userEntity = [[TheUserEntity alloc] init];
TheUserModel* userModel = [[TheUserModel alloc] init];

メソッド名は小文字で始める必要があります。これは慣例です。

于 2012-06-28T00:53:04.497 に答える