vofiella
vofiella

Reputation: 21

iOS Show some error about PNG image

I am using Xcode 4.3.3, I already tried to build my app before and it run. But now I arranged my files inside my project's folder, grouped them by 'button' , 'icon' , 'background'... I also copied some resources/images in other folder put them in order but now I'm in trouble.

Im trying to build my app again in Xcode, I found a CopyPNG Error:

Can't find /Users/vella/Desktop/Sample/res/2.png Command /Users/vella/Desktop/installer/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/iPhoneOS Build System Support.xcplugin/Contents/Resources/copypng failed with exit code 1

Now, I don't know if I missed some png files. I also read some answers like I should save PNG files as NOT INTERLACED or there is a PNG file that is corrupted. How will I know what PNG file is missing or corrupted?

Upvotes: 2

Views: 6256

Answers (5)

Alphapico
Alphapico

Reputation: 3043

You have to save your PNG files as NOT INTERLACED. For example, bu using Photoshop, go to menu File->Save For Web and Devices. Unchecked the box of 'Interlaced' and save the file. Usually interlaced box is unchecked already. Hope that helps

Upvotes: 2

Homer Wang
Homer Wang

Reputation: 600

Clean up the png file in your project and re-import it:

  1. Delete (backup) that file in project navigator. Just delete and move file to trash can.
  2. Go to project Build Phases: i. Select the root project ii. Select TARGETS iii. Select Build Phases tag iv. Expand Copy Bundle Resources list If you see the file you just deleted still exists (maybe in red), delete it
  3. Re-import the file again

This worked for me.

Upvotes: 1

ozgunb
ozgunb

Reputation: 105

I just had the same problem. I always do the same thing to add images to my projects but I never had a problem like this before.

I found in the error message that, the image path that Xcode was trying to find the image was wrong. The path that Xcode is searching was like " ...../My Project Folder/images/favourites.png" but the correct path is like "...../My Project Folder/myProjectName/images/favourites.png". To solve this, I create a folder with path " ...../My Project Folder/images", then I backed up my images and deleted all of them from project window and selected "move to trash". I copied and pasted the images from my backup folder to this new folder. Then I drag-dropped them to "Supporting Files" and select "Copy items into destination group's folder (if needed)". Finally I cleaned the project and run it. It worked for me. Good luck.

Upvotes: 0

IronManGill
IronManGill

Reputation: 7226

Yep, Add it again and this time dont arrange or rearrange any stuff in your resources folder. Also give specific naming to the images so that its easy for you to remember and implement them later in ur project.

Upvotes: 0

Madhumitha
Madhumitha

Reputation: 3824

Check wheather you added 2.png into your project folder.while adding images into your project,click the checkbox "Copy items into destination group folder".If your png file is corrupted, it will be in red colour in your project.

Upvotes: 5

Related Questions