Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PNG images ok on simulator but don't display on device

My iphone app pulls in about 300 images from a bundle, and then on one of my view controllers it displays one at random. This works fine on the simulator (xcode 4.3.3 / iphone 5.0 or 5.1 simulator) but not when I push it to my device (iphone 3gs). The app runs and there are no errors on the log, but that part of the view where the image should be is just blank, like the color of the background.

Things I've tried:

  1. I've checked and double-checked the case of the filenames vs references in code.
  2. I checked the Build Phase called Copy Bundle Resources, and it's definitely set to copy the bundle to the device.
  3. I looked at the log produced by the build, and although that was the first time I'd examined it in detail, it had no errors and seemed to be copying the bundle across. Here's the snippet from the log:

    CpResource FlagQuiz/flagimages.bundle /Users/ian/Library/Developer/Xcode/DerivedData/FlagQuiz-drrjrlxfifrmbnaissqfqxuixchb/Build/Products/Debug-iphoneos/FlagQuiz.app/flagimages.bundle
    cd /Users/ian/Documents/xcodeapps/FlagQuiz
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip /Users/ian/Documents/xcodeapps/FlagQuiz/FlagQuiz/flagimages.bundle /Users/ian/Library/Developer/Xcode/DerivedData/FlagQuiz-drrjrlxfifrmbnaissqfqxuixchb/Build/Products/Debug-iphoneos/FlagQuiz.app
    

Here's a screenshot of the bundle as requested: https://skitch.com/bobsmells/eeask/flagquiz.xcodeproj-afghanistan.png

Any ideas?

like image 580
bobsmells Avatar asked Oct 08 '22 03:10

bobsmells


1 Answers

Issues have been known in the Xcode compression of PNG files. I personally submitted an App to the App Store that refused to be accepted because it had corrupted PNG files - which they were not. Turned out Xcode was corrupting them on build.

Maybe this is the same issue.

Go to Project -> Build Settings and try setting "Compress PNG Files" to NO.

like image 143
Trenskow Avatar answered Oct 11 '22 13:10

Trenskow