Reputation: 1995
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).
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.
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?
Upvotes: 4
Views: 1172
Reputation: 1995
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.
Upvotes: 2
Reputation: 299325
It is unlikely that the problem is the PNGs themselves. If it were, then it would fail every time. What is more likely is that you are corrupting the data, likely due to a race condition (since it is intermittent). For example, you may be executing WebKit calls somewhere other than the main thread. You may have gotten away with that on iOS 6, but on iOS 7 enough may have changed to cause the race condition to fail. If you process these PNGs outside of the UIWebView
, you may have a race condition there. Those are the two main places I'd look.
Upvotes: 5