CopyPNGFile error - iphone

When I archive the application I get CopyPNGerror for all images in my project.I tried all means deleting all the images,adding them again,check Build Phases(copy bundle resources).No duplicates are found.I couldnot understand what to do further and submit the app.When I archive another application with same images archive is successful
CopyPNGFile "/Users/admin/Library/Developer/Xcode/DerivedData/App1-auevnkwujohdqtflzyputmxbvrmt/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App1.app/about2 copy.png" "Classes/../about2 copy.png"
cd "/Users/admin/Documents/App/App (1)"
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/admin/Documents/App/App (1)/Classes/../about2 copy.png" "/Users/admin/Library/Developer/Xcode/DerivedData/App1-auevnkwujohdqtflzyputmxbvrmt/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App1.app/about2 copy.png"
Could not open output file /Users/admin/Library/Developer/Xcode/DerivedData/App1-auevnkwujohdqtflzyputmxbvrmt/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App1.app/about2 copy.pngCommand /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng failed with exit code 1
What shall I do to solve this error?

Solved here -> https://stackoverflow.com/a/18297130/1451462
I removed the duplicate references in my png files!
Build Phases -> Copy Bundle Resources
and removed all the duplicated entries of lunch images DefaultXX.png

I had the same problem, in my case the image causing the problem was a JPG renamed manually in PNG.
I suggest you to open the image in a Image Editor (Gimp, Photoshop...) and save it as PNG.

i face this problem an i solved as #Davide answer
you need to remove any reference for that image
after that clean and build and problem will be fixed

To solve this issue open your image (about2 copy.png) in photoshop or gimp or any similar image editor.
While saving(save as) your image check it as NOT INTERLACED.
Build your project again will remove the error.

I have this happen periodically, my solution, copy the images away, delete them from xcode, then copy them back. Fixes it every time.
Delete the file reference from xcode -> click your project -> Build Phases -> Copy Bundle Resources. Then, add the file again to your project.\
or
Build Settings -> Search for Compress PNG Files and set to NO .
or
You have to save your PNG files as NOT INTERLACED. For example, by 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.

In my case, I just removed the "$" character from the image name.
My case was that, I have image called imagex.png, then I removed that image and added one called imagex$xxx.png, then I got that error, everything went well when I just removed the dollar sign from the name.

Delete the file reference from xcode -> click your project -> Build Phases -> Copy Bundle Resources. Then, add the file again to your project.

I had the same problem. I have fixed it.
In my case. This error occurs because I have multiple files with the same name. To fix this. I delete remove the files from my project and the import again. Instead of create a group in project. I create a folder reference and everything works great as I expected!

Just remove the image file from the Xcode project, rename it as you want on FINDER and then readd it to you project. I just had this problem a while ago.

This is due to copy of image of same name in Project.

if there are icons in the exact path. you should check that all the icons are really png . just open icons in some editors and save as the icon in png format

Found those images are red in color in project.Simply deleting & readding them worked.

Just try deleting the .png extension for the files which are causing you the trouble.
Don't know how, but worked for me!

Related

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?
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.
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
Clean up the png file in your project and re-import it:
Delete (backup) that file in project navigator. Just delete and move file to trash can.
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
Re-import the file again
This worked for me.
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.
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.

Missing file on XCode 4 showing the warning file://localhost/.../WaveView.h: warning: Missing file: /..../WaveView.h is missing from working copy

In my iPhone app I am implementing Audio Recording, It works on iPhone simulator/Device
and It says missing of file as below:
Missing File
file://localhost/.../WaveView.h: warning: Missing file: /..../WaveView.h is missing from working copy
and the file WaveView.h & WaveView.m shows red color in left slide bar and I revealed in finder to delete this file but that file is not existing on the app folder.
Can anyone suggest me to solve this problem
Thanks in Advance!!!
Only solution for your problem is copy the files back to your app. Make sure that you are copying to the project(obviously this is the best practice).
It sounds like you added the file 'relative' to the project instead on 'copying' the file to the project. This issue is probably appearing because you moved the project and the file is no longer in the same relative position.
Just re-add the file to the project and copy it in to the project folder
Implies your WaveView files are missing. Put them back. If you dont need them then remove referenceds from XCode.

Could not load "my-icon.png" image referenced from a nib (iPhone)

I am receiving the following error message:
2011-02-11 14:47:13.815 myProject[13177:207] Could not load the "icon-troubleshoot.png" image referenced from a nib in the bundle with identifier "com.myCompany.myProject"
This file is an old file that was being used before, but has now been deleted. As far as I know icon-troubleshoot.png is not used anywhere in my project. I tried cleaning and rebuilding, emptying caches but it didn't work. Searching for the string troubleshoot as a textual reference and "contains" selected returned nothing. Does anyone know how I can find what is causing this error?
The warning message suggests there is a reference to this png file in your .xib or .nib file(s).
Now the question is how to find it. Xcode is poor at doing this. Opening every nib file in a text editor like textedit and manual searching is time consuming.
The best solution I have for such searching tasks is to fire up terminal and use grep command. Go to source folder of your project in terminal then you can run the following in your case:
grep -i -r --include=*.xib "my-icon.png" ./
This will return all *.xib files where my-icon.png is referenced.
Later when you will see those *.xib files in xcode you'll find a '?' sign in place of my-icon.png showing that image is indeed missing as you deleted it. Now you deleted it to replace it with another image. So select '?' mark symbol, open Utilities area (to the right) and choose the correct file name. That is all.
as far as I know the search tool of x-code do not search inside the xib files that's why your search returns nothing. Anyway It's really probable there's still a reference in a xib file somewhere. Because xib files are just xml, if you don't want to check all them manually, try to open all your xib with a text editor like TextMate and perform a global text search over the content for the .png filename.
Hope this helps.
Ciao!
Clean the whole project and recompile.
There must be a reference to this file in one of the nibs. If you can't find it, try deleting the nib file where the image was used, and create a new one.
Also, check your bundle for a reference to the image file.
I had this exact same issue and I found that when I included this file in the project I didn't specify both my Development and Distribution targets, only Development, so as soon as I tried building Distribution target, it wasn't found. You have to delete reference to this image, then re-add it and make sure you checkmark all of the targets that it should be found in.
This could happen if you only have an imageName#2x.png image and have run a low resolution non-retina display build.
Cut the height and width in half in your favorite image editor and then save it in the same folder as the #2x as imageName.png
Select your storyboard object in solution explorer, right click on storyboard->"Open As"->"Source Code", now you will see xml code from storyboard. Search your image name with Cmd+F and replace or remove it.

cannot add image files to xcode resourse folder

I tried adding images to my xcode resourse folder by drag and drop. But its showing me the error cannot add the image...
can anyone tell me what is going wrong... i had previously added images like this and that had worked .but now its not working...
Is this by any chance an image you have previously deleted from your project? Occasionally there is a bug that prevents reading them back. If so, open the project.pbxproj file and delete all references to that file, then try to add your image.
Be more specific on the error message. Did you check "Copy item to destination's group folder"?

How do I make Xcode refresh its local copies of my project's image files?

I'm having some weird issues with Xcode, and this is pretty much impossible to find answers by simply googling around.
I have a few icon image files (just PNGs) in my Xcode project, and when I modify some of them in Photoshop, they don't get updated when I do another build in Xcode. In order to fix this I have to re-add the file again to the project, and then remove the old version of the file that is already in there in Xcode.
What am I doing wrong here? I'm updating/replacing the image file that is stored in my project's directory directly from Photoshop, so I assumed that it would just get reloaded and the new version would show up.
UPDATE: Looks like what happened was that when I first imported the image files into my project, they got added to my "Classes/" sub-directory. So when I was updating them, it was just adding them to the root of my project.
I had the exact same problem.
The following fixed it for me:
In Xcode, go to Project --> Clean
This will purge the old images from xcode cache and will show your new image
That's pretty weird. I'd suggest two things:
Check that you're not saving your
photoshop files into the wrong
directory. I know this seems
straightforward but its worth a
check. Make sure you're not saving
them into the build/ directory or
anything like that.
Before running again in the simulator, try cleaning all build targets first to ensure that your project actually builds again before launching the simulator.