Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
708 views
in Technique[技术] by (71.8m points)

objective c - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...