我的应用程序因错误而崩溃:+ [AccountService createMockAccountData] 无法识别的选择器已发送到类 0x89e40 ..请告知我该如何解决此错误?我是 Objective C 的新手。这是我的代码:
@interface AccountService : NSObject
+ (NSMutableArray *)accounts: createMockAccountData;
@end
#import AccountService.h"
@implementation AccountService
+(NSMutableArray *)accounts: createMockAccountData{
NSMutableArray * accounts = [[NSMutableArray alloc] init];
UserAccount *mockUserAccount1 = [[UserAccount alloc] init];
*mockUserAccount1 setName:@"Stella"];
[accounts addObject:mockUserAccount1];
UserAccount *mockUserAccount2 = [[UserAccount alloc] init];
[mockUserAccount2 setName:@"Marko"];
[accounts addObject:mockUserAccount2];
[mockUserAccount1 release];
[mockUserAccount2 release];
return accounts;
}
……
在我的控制器中......我正在调用这个类方法,如下所示:
NSMutableArray *accounts = [AccountService createMockAccountData];
NSUInteger count = [accounts count];
NSLog(@"# of records = %d",count);
谢谢!