Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c UIWebView没有';我不能正确对待html_Objective C_Uiwebview - Fatal编程技术网

Objective c UIWebView没有';我不能正确对待html

Objective c UIWebView没有';我不能正确对待html,objective-c,uiwebview,Objective C,Uiwebview,我正在将以下字符串发送到UIWebView: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> <img src="mysrc"></img> </html> 结果是:

我正在将以下字符串发送到
UIWebView

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<img src="mysrc"></img>
</html>
结果是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<img src="mysrc">
</html>


如何使
UIWebView
不更改HTML标记?

IMG是一个自动关闭标记,因此它应该是:

<img src="mysrc" />

为了完全符合标准,还应定义ALT属性:

<img src="mysrc" alt="something" />


这可能是解析错误的原因。

我不完全理解您的问题-我认为您没有发布发送的原始字符串。我认为这是不可能的,即使使用私有方法。WebKit丢弃了“多余的”结束标记,并且从不让它们返回。您是在“结果”中复制/粘贴了确切的值,还是只是手动删除了结束标记以匹配调试器中看到的内容?换句话说,您确定第三行是
,而不是
(带斜杠)?在HTML中,img不需要关闭。它不需要用关闭标记显式关闭,但它确实需要如我所述以/>结尾。
<img src="mysrc" alt="something" />