对象C代表不兼容类型
问题描述:
我正在使用http://www.vfr.org/,pdf查看器,并尝试添加一个按钮以在IBOOK中打开PDF。对象C代表不兼容类型
我向它添加了按钮和动作,但是当我想用这个pdf格式打开ibooks应用程序时,我困惑了。
我试过2个解决方案:
-
按钮窃听行动:
NSURL *fileURL = document.fileURL; NSString *fileName = document.fileName; // Document [[UIApplication sharedApplication] openURL:fileURL];
它打开了IBOOKS但从来没有PDF被加载。
我假设URL格式可以是错误的我试过甚至硬编码PDF网址,如:
NSString *stringURL = @"itms-books://linktopdf.pdf";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
但相同的结果。
2)按钮窃听行动:
NSURL *fileURL = document.fileURL;
NSString *fileName = document.fileName; // Document
UIDocumentInteractionController *docController = [[UIDocumentInteractionController alloc] init];
docController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
docController.delegate = self;
但是我有一个警告,我试图委派:docController.delegate = self;
assigning to id UIDocumentInteractionControllerDelegate from Incompatible ReaderViewController
有人可以帮助我,使工作至少1这些解决方案。
答
已在ReaderViewController这种行在头文件中:@interface ReaderViewController : NSObject <UIDocumentInteractionControllerDelegate>
?
Larme,我更新的问题 – AlexC 2013-02-12 14:47:50
我在@interface动了我的变数名称,但我认为这是不正确的 – AlexC 2013-02-12 14:48:19
我还没有看到的'UIDocumentInteractionControllerDelegate' * *。它应该是这样的:'@interface ReaderViewController:的UIViewController' –
Larme
2013-02-12 14:58:58