问题描述
我在iPad上运行项目时添加图像时出现以下错误。
它在所有图像的模拟器上运行良好但在iPad上运行但没有显示图像。
I am getting following error while adding images the running the project on iPad.It worked fine on simulator with all images but on iPad its running but showing no images.
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
推荐答案
案例1:格式差异
当我更改图像时,它有效从jpg到png,使用预览。以前它可能不起作用,因为.png作为名称而不是格式。
这有帮助。
It worked when i changed the images from jpg to png, using Preview. Previously It might not be working due to .png as name only not as format.This link helped.
还可以在单步使用终端中将多个图像转换为文件夹中的png。
使用cd goto包含图像的文件夹(JPG或任何类型)。
run代码:
Also to convert the multiple images to png in a folder in single step use terminal.Using cd goto the folder containing the images (JPGs or any type).run Code:
mkdir pngs; sips -s format png *.* --out pngs
它会将你的图像转换为.png和将创建一个pngs文件夹,其中包含已转换的图像。
It will convert your images to .png and will create a pngs folder contain the converted images.
案例2:两个同名的图像或一个图像添加两次:
作为Rajneesh071& Himanshu建议:可以为同一图像添加两个或多个具有相同名称的图像或两个目标。
转到项目目标 - >构建阶段 - >复制捆绑资源并搜索您的图像文件名。并删除重复的文件。
As Rajneesh071 & Himanshu suggested: There can be two or more images with same name or two targets were added for same image.Goto project target ->Build Phases -> Copy Bundle Resources and search for your image file name. and remove the repeated file.
这篇关于不是PNG filCommand copypng发出错误但没有返回非零退出代码来指示失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!