私はhttp://www.vfr.org/、pdf ビューアーを使用しており、IBOOK で PDF を開くためのボタンを追加しようとしています。
ボタンとアクションを追加しましたが、このpdfでibooksアプリケーションを開きたい瞬間に行き詰まりました。
私は2つの解決策を試しました:
ボタンタップアクション:
NSURL *fileURL = document.fileURL; NSString *fileName = document.fileName; // Document [[UIApplication sharedApplication] openURL:fileURL];
IBOOKS を開きますが、PDF は読み込まれません。
URL 形式が間違っている可能性があると想定しています。次のような PDF URL をハードコードしてみました。
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 つを機能させるのを手伝ってくれますか?