不是PNG filCommand copypng发出错误但没有返回非零退出代码来指示失败

HDd*_*per 21 iphone default.png ipad ios ios6

我在iPad上运行项目时添加图像时出现以下错误.它在所有图像的模拟器上运行良好,但在iPad上运行但没有显示图像.

CopyPNGFile /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png PhotoBrowserDemo/Default.png
    cd /Users/user/Desktop/Demo
    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/user/Desktop/Demo/PhotoBrowserDemo/Default.png /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.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




(null): While reading /Users/user/Desktop/Demo/PhotoBrowserDemo/Default.png pngcrush caught libpng error:




(null): Could not find file: /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png




Command /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
Run Code Online (Sandbox Code Playgroud)

Him*_*tri 112

我的答案:

我有这个问题.为同一图像添加了两个目标.转到项目目标 - >构建阶段 - >复制捆绑资源并搜索您的图像文件名.

最有可能有两个条目.删除一个.

通过这样做,我解决了我的问题.这对我有用:) :)

乐于帮助 :) :)

  • 值得补充的是,您可能会认为**已将两个具有相同名称的图像放在不同的目录中,但从最终捆绑包的角度来看,Xcode中的文件夹并不是真正的目录 (2认同)

HDd*_*per 39

案例1:格式差异

当我使用预览将图像从jpg更改为png时,它工作正常.以前它可能不起作用,因为.png作为名称而不是格式.这个链接有帮助.

也可以在单步使用终端中将多个图像转换为文件夹中的png.使用cd转到包含图像的文件夹(JPG或任何类型).运行代码:

mkdir pngs; sips -s format png *.* --out pngs
Run Code Online (Sandbox Code Playgroud)

它会将您的图像转换为.png,并创建一个包含转换后图像的pngs文件夹.

案例2:两个具有相同名称的图像或一个图像添加两次:

正如Rajneesh071和Himanshu所说:可以为同一图像添加两个或更多具有相同名称的图像或两个目标.转到项目目标 - >构建阶段 - >复制捆绑资源并搜索您的图像文件名.并删除重复的文件.