1

CJSHWork 作为一个类在 CJSHWork.h 和 CJSHWork.m 中定义。在 CJSHWork.h 我有:

@interface CJSHWork : NSObject

@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *url;

-(id) initWithName:(NSString *)name filename:(NSString *)title content:(NSString *)url;

@end

在 CJSHWork.m 我有:

- (id) initWithName:(NSString *)name title:(NSString *)title content:(NSString *)url
{
    self = [super init];
    if (self)
    {
        _name = name;
        _title = title;
        _url = url;
    }
}

我在 CJSHDataController.m 中有,

import "CJSHWork.h"

...

CJSHWork *work = [[CJSHWork alloc] initWithName:@"" title:allWorks[i][1] url:url];

这会得到错误“ No visible @interface for CJSHWork declarations the selector initWithName title url ”。

这是怎么回事,我该如何解决?

4

1 回答 1

6

您的方法名称是 initWithName:title:content: 不是 initWithName:title:url:

于 2013-09-09T22:29:39.190 回答