大家好, 我想在uiwebview中打开pdf文件到其他应用程序。我可以像这样显示弹出窗口。
screen http://i33.tinypic.com/axv1i.jpg
我写这样的代码。我也把代表。 UIDocumentInteractionControllerDelegate
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
//other code
if([fileType isEqualToString:@"pdf"])
{
NSLog(@"It is pdf file.");
//other code to save to nsdocumentdirectory and then get this path
// file://localhost/var/mobile/Applications/024D40FF-4518-4526-BEAB- 2A0679FD6308/Documents/iphone_user_guide.pdf
NSURL *pdfURL = [NSURL fileURLWithPath:pathToDownloadTo];
UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:pdfURL];
[docController setDelegate:self];
[docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
}
}
- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
return self;
}
我收到了这个错误。 void SendDelegateMessage(NSInvocation *):委托(webView:didFinishLoadForFrame :)等待10秒后无法返回。主运行循环模式:kCFRunLoopDefaultMode
在某些链接中,它说是由于Javascript。我也需要使用它。 stringByEvaluatingJavaScriptFromString
但是我已经禁用了该功能并进行了测试。然后,没有错误,但应用程序崩溃。
我想知道是否还有一些东西要转移文件。 此外,我想知道如何在uiwebview中以编程方式添加Uibarbutton,例如“在ibook或sth中打开”,并在我们打开pdf文件时使用Safari中的一些代码。
关心,