iOS 真机调试时出现CopyPngFile error解决方法 (三种)

本文介绍了解决iOS应用在真机调试时出现Copypngfile错误的方法,包括禁用PNG压缩、重新导出PNG文件及调整资源复制配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在模拟器上调试没有问题,但一放到真机上调试就出现copypngfile 的错误,错误信息如下:

CopyPNGFile /Users/gongihou/Library/Developer/Xcode/DerivedData/DLZ-frborfduejxrajgpkfdaipygijow/Build/Products/Debug-iphoneos/DLZ.app/luffy.png DLZ/apple.png
    cd /Users/gongihou/Documents/910
    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"
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng -compress "" /Users/gongihou/Documents/910/DLZ/zhuangtai.png /Users/gongihou/Library/Developer/Xcode/DerivedData/DLZ-frborfduejxrajgpkfdaipygijow/Build/Products/Debug-iphoneos/DLZ.app/zhuangtai.png

   Not a PNG filCommand /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure

1.在build settings里把工程里的Compress PNG files设置为NO,问题解决,但这样设置以后,弄出来的ipa会很大,感觉不是很理想。
2.将png文件打开,重新导出为png文件或者使用PS把png图片保存为NOT INTERLACED(不交错的)。
3.在Build Phases里的CopyBundleResource中删除红色的报错的文件即可。
!!!注意:如果使用了storyboard或者xib布局的朋友们,LaunchScreen.xib和Main.storyboard虽然为红色,但是最好不要删除。因为笔者出现过删除后程序运行就崩溃的显现。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值