无法识别的选择器发送到类0x89e40

时间:2012-06-04 20:11:40

标签: objective-c ios

我的应用程序因错误而崩溃:+ [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);

谢谢!

2 个答案:

答案 0 :(得分:3)

变化

+(NSMutableArray *)accounts: createMockAccountData{

+(NSMutableArray *)createMockAccountData{

答案 1 :(得分:2)

你的语法搞砸了。方法标题如下所示:

 - (return type)name:(parameter type)parameterName