我有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:
我该如何解决这个问题?
答案 0 :(得分:3)
检查方法声明是否在DocumentViewController
的头文件中。它应该是这样的
- (id)initWithURL:(NSString *)linkToPdf withFileName:(NSString *)fileName;