我有一个使用 UIWebView
的应用程序,并且在 iOS 6 上一切都(现在仍然是)完美运行.但在 iOS 7 上,它有时会返回错误 ImageIO: PNG not a PNG file
当我尝试加载某些 PNG 文件时(例如 这个).
I've got an app that uses a UIWebView
, and everything was (and still is) working perfectly on iOS 6. On iOS 7, though, it is sometimes kicking back an error ImageIO: PNG not a PNG file
when I try to load certain PNG files, (for example this one).
现在,显然 PNG 文件并没有损坏,因为它们可以在 iOS 6 上运行,而且它们有时甚至可以在 iOS 7 上运行,但有时它们会消除该错误.我找不到任何确定错误发生时间的常见原因,而且我没有对它们做任何可能导致它的异常:我的代码除了在 UIWebView 中加载页面之外没有触及它们,所以它似乎是 WebView 在内部做的事情.当然,这使得确定起来更加困难.
Now, obviously the PNG files aren't corrupted because they work on iOS 6 and they sometimes work even on iOS 7, but then sometimes they kick back that error. I can't find any common cause that determines when the error happens, and I'm not doing anything unusual with them that might account for it: my code doesn't touch them other than to load the page in the UIWebView, so it seems to be something that the WebView is doing internally. This, of course, makes it even harder to pin down.
我知道这是一个奇怪的问题,有点像问福特是否改变了车轮的工作方式",但是 Apple 是否改变了它在 iOS 7 中处理 PNG 的方式? 任何人都可以想到什么可能会解释对于这个 iOS 7 特有的错误?
I know this is a weird question, kind of like asking "did Ford change how wheels work", but did Apple change how it handles PNGs in iOS 7? Can anyone think of what might account for this iOS 7-specific error?
原来问题出在 PNG 文件本身:有人在 Photoshop 中打开了某些文件进行编辑,而这些文件在某些条件下无法正常工作.我不知道到底是什么让它们无法被应用程序接受,但是当我们重新导出它们时,它们运行良好.奇怪,但解决了.
Turns out the problem WAS with the PNG files themselves: someone had opened certain ones in Photoshop to make edits, and those files weren't working under certain conditions. I don't know exactly what it was about them, under the hood, that made them unacceptable to the app, but when we re-exported them, they worked perfectly. Strange, but solved.
对任何阅读此问题的人的建议:如果需要,在各种设置和条件下重新导出文件,看看它们是否开始工作.
Recommendation for anyone reading this with a similar issue: re-export your files, under a variety of settings and conditions if need be, and see if they start working.
这篇关于iOS 7 是否改变了 PNG 的兼容性/处理方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!