ARC语义问题 - 没有可见的@interface

时间:2013-04-10 23:50:42

标签: ios objective-c

我有2个UIViewController类 - DocumentViewController和LibraryViewController。

在DocumentViewController类中,我有以下代码:

- (id)initWithURL:(NSString *)linkToPdf withFileName:(NSString *)fileName{
     //some code goes here ... 
}

我正在尝试使用代码

从LibraryViewController加载DocumentViewController类
DocumentViewController *documentViewController = [[DocumentViewController alloc] initWithURL:@"http://investor.google.com/pdf/2012Q4_google_earnings_slides.pdf" withFileName:@"Google Earnings Slides"];
[self presentViewController:documentViewController animated:NO completion:nil];

当我构建时,我在LibraryViewController类中遇到错误 'DocumentViewController'没有可见的@interface用initWithURL声明选择器:withFileName:

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

检查方法声明是否在DocumentViewController的头文件中。它应该是这样的

- (id)initWithURL:(NSString *)linkToPdf withFileName:(NSString *)fileName;