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 ”。
这是怎么回事,我该如何解决?