Build app with Xcode 4 - it always show some error

2019-01-16 04:04发布

When I build my app with Xcode 4 it always show this error message:

CopyPNGFile /Users/michaelchen/Library/Developer/Xcode/DerivedData/iMusicBox-boeawugacmhacbdtyymnprzfobyq/ArchiveIntermediates/iMusicBox/InstallationBuildProductsLocation/Applications/iMusicBox.app/list_cell.png Images/list_cell.png
    cd /Volumes/WORK/Works/iMusicBox
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    "/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/iPhoneOS Build System Support.xcplugin/Contents/Resources/copypng" -compress "" /Volumes/WORK/Works/iMusicBox/Images/list_cell.png /Users/michaelchen/Library/Developer/Xcode/DerivedData/iMusicBox-boeawugacmhacbdtyymnprzfobyq/ArchiveIntermediates/iMusicBox/InstallationBuildProductsLocation/Applications/iMusicBox.app/list_cell.png

While checking alphas in /Volumes/WORK/Works/iMusicBox/Images/list_cell.png pngcrush caught libpng error: Not enough image data

but It's OK with Xcode 3.2 - why?

标签: xcode xcode4
22条回答
戒情不戒烟
2楼-- · 2019-01-16 04:42

Follow the steps:

 1. Take an image. 

 2. Rename it to the showing error png's name. 

 3. Drag it back to the Xcode.
查看更多
男人必须洒脱
3楼-- · 2019-01-16 04:44

Found it!!

You have to save your PNG files as NOT INTERLACED. Try to open the file in photoshop (or similar), save as, and select "Not interlaced".

It is working in my case

hope this helps

查看更多
男人必须洒脱
4楼-- · 2019-01-16 04:44

It may be the "Compress PNG Files" setting (from the Packaging section of Build Settings).

I solved this error by switching it to "No".

查看更多
干净又极端
5楼-- · 2019-01-16 04:45

Check that you don't have duplicate entries in the Target's "Build Phase"-> "Copy Bundle Resources"

查看更多
做个烂人
6楼-- · 2019-01-16 04:45

Mine weren't interlaced but I kept getting odd errors from pngcrush. Eventually I deleted the files not just disk but through XCode. I added them back in one by one by drang-and-drop into XCode, building after each, expecting to hit one that had an issue. I never did. My conclusion is that you really need to manipulate the files from XCode and not the filesystem at all.

查看更多
Deceive 欺骗
7楼-- · 2019-01-16 04:47

In my case, I had to remove all PNG files from the folder and then re-adding the files again without drag-and-dropping the images into the Xcode UI (under Launch Images). The latter was key in my case, first adding the files to the folder and then dragging them into the UI somehow cause a duplicate which screwed it all up. Try that out if nothing else's working for you.

查看更多
登录 后发表回答