page.zip 文件将无法使用 UIWebview 和 NSURL 显示视图
我有一个显示搜索提示的应用程序。如果我将 .html 文件存储在主包中并使用 Apple 示例代码显示它,这将起作用:
-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView
{
NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
//load document --
[self loadDocument:@"searchTipsLegislators.html" inView:searchTips];
但是,如果我将文档更改为使用压缩页面文件创建的文档,则应用程序将返回错误:
2010-12-15 08:53:04.537 cv112[42067:7003] 无法加载 iWorkImport
2010-12-15 08:53:04.538 cv112[42067:7003] 无法生成预览
有人让它工作吗?
I have an application that displays search tips. This will work if I store an .html file in the main bundle and display it using the Apple example code:
-(void)loadDocument:(NSString*)documentName inView:(UIWebView*)webView
{
NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
//load document --
[self loadDocument:@"searchTipsLegislators.html" inView:searchTips];
If however I change the document to one created using a compressed Pages file the app return the error:
2010-12-15 08:53:04.537 cv112[42067:7003] Cannot load iWorkImport
2010-12-15 08:53:04.538 cv112[42067:7003] Failed to generate preview
Has anyone gotten this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要尝试两件事:
不要压缩页面文档。从 iOS 3 开始不再需要这样做。
不要指望这能在模拟器上工作。它可以在您的设备上运行吗?
Two things to try:
Don't compress the pages document. This is no longer necessary as of iOS 3.
Don't expect this to work on Simulator. Does it work on your device?