简体   繁体   English

PNG图像在模拟器上正常,但不在设备上显示

[英]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. 我的iPhone应用程序从一个捆绑包中提取了大约300个图像,然后在我的一个视图控制器上随机显示一个。 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). 这在模拟器(xcode 4.3.3 / iphone 5.0或5.1模拟器)上工作正常,但是当我将它推到我的设备(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. 我检查了名为Copy Bundle Resources的Build Phase,它肯定会将bundle复制到设备上。
  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 以下是所请求的软件包的屏幕截图: https//skitch.com/bobsmells/eeask/flagquiz.xcodeproj-afghanistan.png

Any ideas? 有任何想法吗?

Issues have been known in the Xcode compression of PNG files. 在PNG文件的Xcode压缩中已知问题。 I personally submitted an App to the App Store that refused to be accepted because it had corrupted PNG files - which they were not. 我个人向​​App Store提交了一个拒绝被接受的应用程序,因为它已经损坏了PNG文件 - 它们不是。 Turned out Xcode was corrupting them on build. 原来Xcode在构建时破坏了它们。

Maybe this is the same issue. 也许这是同一个问题。

Go to Project -> Build Settings and try setting "Compress PNG Files" to NO. 转到项目 - >构建设置,然后尝试将“压缩PNG文件”设置为NO。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 图像不会显示在设备中,而是显示在模拟器中 - Images don't display in device but in simulator 仅显示一些png图像,而其他图像则没有明显原因 - Only some png images display, others don't for no apparent reason 在 Cordova 应用程序中,物理 iPhone SE 无法显示来自“file://”URL 的图像; 在iOS模拟器和Android中OK - In Cordova app, physical iPhone SE can't display images from "file://" URLs; OK in iOS simulator and Android 图片已加载到模拟器中但未加载到设备上? - Images loaded in simulator but not on device? 图像显示在模拟器中但不在设备中 - images are displaying in simulator but not in device Facebook 登录 Swift 在设备上不起作用(但在 IOS 模拟器上起作用) - Facebook Login Swift don't works On Device (But do on IOS Simulator) 故事板上可见的Xcode图像不会在模拟器中显示 - Xcode images visible in storyboard don't show in simulator 在ios通用设备上构建失败,但对于模拟器可以 - Build failing on ios generic device but Ok for simulator 无法使Accessoriesview在设备上工作,但在模拟器中可以 - Unable to make accessoryview work on device, but OK in simulator 在模拟器中可以,但是在iOS设备中引发异常 - Ok in simulator but throwing exception in ios device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM