ios 真机调试时出现CopyPngFile error解决方法

来源:互联网 发布:淘宝介入对卖家不公平 编辑:程序博客网 时间:2024/05/17 06:57

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

CopyPNGFile /Users/bearsg/Library/Developer/Xcode/DerivedData/DLZ-frborfduejxrajgpkfdaipygijow/Build/Products/Debug-iphoneos/bearsg.app/AD.png bearsg/AD.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/bearsg/Documents/910/bearsg/AD.png /Users/bearsg/Library/Developer/Xcode/DerivedData/bearsg-frborfduejxrajgpkfdaipygijow/Build/Products/Debug-iphoneos/bearsg.app/AD.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

意思说是读取的时候没有找到这张图片,检查了一下图片路径,没有问题,于是google之,找到


两种解决方法 :


  • 1.在build settings里把工程里的Compress
    PNG files设置为NO,问题解决,但这样设置以后,弄出来的ipa会很大,感觉不是很理想。

  • 2.mac上的preview(预览)打开出问题的png文件,然后重新导出为png文件或者用photoshop把png图片保存为NOT
    INTERLACED(不交错)的,这样真机调试时就没有错误了。


不过上面的我还是不甘心所以又找出来更完美的一种,(个人觉得报错原因可能与之前图片文件格式有关)解决方法如下:


  • 把之前放在项目文件中的报错图片彻底从项目中删除

  • 接着点击进入项目中:Assets.xcassets文件夹

  • Import之前报错的图片文件

  • run

0 0
原创粉丝点击