我正在使用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這些解決方案。
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