0

由于名称中有空格,WebView 无法显示本地 .htm 文件。我收到错误

Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this   server." UserInfo=0x400ea1900 {NSUnderlyingError=0x400265c80 "The requested URL was not found on this server.", NSErrorFailingURLStringKey=file:///Users/olgadalton/Library/Caches/ee.64.xxx/_books/Deployment-guide-for-Microsoft-SharePoint-Server-2010_2/OEBPS/Text/Deployment%2520Guide%2520for%2520Microsoft%2520SharePoint%2520Server%25202010_split_000.htm, NSErrorFailingURLKey=file:///Users/olgadalton/Library/Caches/ee.64.xxx/_books/Deployment-guide-for-Microsoft-SharePoint-Server-2010_2/OEBPS/Text/Deployment%2520Guide%2520for%2520Microsoft%2520SharePoint%2520Server%25202010_split_000.htm, NSLocalizedDescription=The requested URL was not found on this server.}

但是文件存在于finder和终端列表中:

ls -l
total 6024
-rw-rw-r--@ 1 olgadalton  staff   3925 Oct 11  2011 Deployment Guide for Microsoft SharePoint Server 2010_split_000.htm

权限也可以。

4

1 回答 1

0

问题已解决:在使用之前需要取消转义的 url 中有额外的 %25:

[NSURL fileURLWithPath: .... ]

将其更改为:

[NSURL fileURLWithPath: [ .... stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]]
于 2012-09-03T12:20:11.073 回答