Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has iOS 7 changed PNG compatibility/handling?

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?

like image 378
Nerrolken Avatar asked Mar 22 '23 22:03

Nerrolken


1 Answers

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.

like image 104
Rob Napier Avatar answered Mar 31 '23 15:03

Rob Napier