I can't understand why this code is throwing exception of Bad Access:
- (void)viewDidLoad
{
TheUserEntity* userEntity = [TheUserEntity alloc];
TheUserModel* userModel = [TheUserModel alloc];
userEntity = [userModel Read:1];
[super viewDidLoad];
}
TheUserEntity and TheUserModel are my own classes, 1 has only properties other only CRUD methods
any help? I'm new in iOS development, thanks
You have to call init
on your objects:
TheUserEntity* userEntity = [[TheUserEntity alloc] init];
TheUserModel* userModel = [[TheUserModel alloc] init];
Your method names should start with lower case letters, that's a convention.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.