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.
Related
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!
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.
i am trying to update my application using application loader. when i submit the archive file, i got this error
"icon specified in the info.plist not found under the top level app wrapper.icon57.png"!
i have deleted the icons from my project and tried again, but the error exist. is their any way to remove this error?
my info.plist displays these icons
This could help you, i think your filenames are wrong:
I usually put this image in my dashboard so you can fast access to the filenames.
+1 to Mat's answer, also please check out this thread that you may need, I had these errors even with the correct name, so this could be interesting:
Xcode Project Icon files and Organiser Archives artwork
Your app icon must be named as Icon.png which is of size 57*57.You have to rename the image and change that name in the info plist.App icon for retina display should be of size 114*114.And it should be named as Icon#2x.png.Rename ur this image and correct it in the info plist too.And ur splash screen should be named as Default.png
This is sometimes due to the compression that apple does during compiling. You should make sure the file type is correctly set to "Icon". Click on the icon in the project navigator and under "Identity and Type" you can set the File Type to "Icon"
My problem was I ended up with some empty keys in my plist file. I deleted all Icon plist entries, saved the plist, and then added the icons a second time through the Target Summary page.
I tried all of the steps detailed here, many of which have solved this problem previously.
The only way I could get this to work recently was to open the archive file (right click in the Organizer->Archives) and open the actual bundle that's going to be uploaded (show package contents for the archive and then the .app file inside the archive) and copy the icon files directly into there. Resubmitted the previously failed archive then solves the issue.
This one has me confounded, so I'll try to go through the chronology so someone smart than I am can show me where I'm going wrong.
Everything was working perfectly on my app, both on the device and on the simulator. I have an image file, myimage.png, that is located in the directory where my project is and has been added to the project. It shows up in XCode and everything.
I build, run, and things work as planned.
Then I decided to get clever in photoshop and spruce up my image with a bit more color. In the finder, I deleted myimage.png from the directory where my project is located. Then I saved the new image as myimage.png in that very same directory. Back in XCode, the file shows up in the project and looks just as nice as planned.
I build, run, and no image shows up. WTF??!?
Here are my two questions, in order of importance:
How do I fix this so that my image shows up again?
What have a done wrong in this process?
Thanks!
EDIT: Here is the code where I am calling the image. In myViewController.m:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// SOME CODE THAT DOES OTHER THINGS UNRELATED TO imageView
[imageView setImage:[UIImage imageNamed:#"myimage.png"]];
// MORE CODE THAT DOES OTHER THINGS UNRELATED TO imageView
}
ANOTHER EDIT: Not one single character of my code changed between the app working and not working. I appreciate all of the suggestions since I clearly cannot figure this one out on my own, but the problem is most likely not with the code.
easy: in xCode delete the file reference and the files themselves and then import it again...
mhm... when you changed your image was xCode opened? it may have seen somehow it's been deleted and lost the link... if you change it xCode could "choose" to NOT include it in the target mainBundle when you build your project... in xCode select the file and see if the checkMark on target is selected:
if not it won't be included in you app (and this answers to your n:1 question too)...
maybe a better way to add a resource files which could be probably be modified by other programs in future while yourProject could be opened (i do it with an html site to be included, jpg and gif too) is to put them in a subFolder of your project and then add all that folder to your xCode project AND in the dialog window choose:
"create folder references..."
that will create a blue folder in xCode and all its contents will refresh automatically if you change, add, delete files or subfolder inside it...
BUT remember that the subFolders will exist in the same tree-order in your app mainBundle, so if you need to load a .png you need to specify where to find it.
PS
check also that the file name is exactly the same of the old file, including UpperCase chars
("a" != "A")
I think that happens because Xcode doesn't know that the file has changed. Always add/remove files in the project navigator.
It should work if you clean your project and build again.
You'll need to do a Build -> Clean. And the rebuild.
SplitView[1290:307] Could not load the "canary04.png" image referenced from a nib in the bundle with identifier "xx.co.mycompany.ipad.SplitView"
I only get the error when running on the device. There are no problems running in simulator.
I am using the image directly in interface builder with an UIImageView.
EDIT: I have added a different new image to a different nib and that works no problems.
Anyone have any ideas?
It might not be added to your Target and in XCode 4 you can do it like this:
In your Project View, click your project name
Select your target and select "Build Phases" tab
Drag your image file into your "Copy Bundle Resources" section
That fixed it for me.
The filesystem on iOS devices is case sensitive, so it's quite possibly a case issue. (Mac OS X is generally case in-sensitive, hence you've not seen this issue in the simulator.)
As such, check that you're using the same case in the code as the filename itself.
Do you have the image in a referenced folder in XCode (blue folder)? If so you have to include the folder name in the image path, something like "Images/canary04.png"
The easy way
1 Simply do a grep in command shell to find the string of the referenced image:
grep -R 'canary04.png' YourMainDirectoryFolder/*
2 It will give you (for example) an output like this:
YourProject/en.lproj/YourViewController.xib:
<textField borderStyle="roundedRect" background="canary04.png" id="19">
3 You now know which nib file and which element it is. Just go in the file and remove the reference.
Delete the blue folder where the image is.
Import again and select "Copy items if needed".
Select "Create Groups" NOT folders
Save image as PNG-24. It works for me
You can do this to check it from your storyboard, or nib. Open it as Source Code:
Then "Find" the image name in it, see if it exists but already invalid in your project, probably you have deleted or changed its name, and now it doesn't seem valid.
Have you included the file in the target? Right-click on your Target in Xcode, select Get Info and choose the "Targets" group along the top. Make sure your intended target(s) are checked.
Good Luck.
EDIT:
The text above should have read Right-click the file (canary04.png) in Xcocde and select Get Info...
Sorry for the typo.
I had this problem when I upgraded to Xcode 4.4.1. I found that although I had deleted the images (and corresponding buttons, etc.) in the storyboards, there was still mention of them in my storyboard files (in a tabBarItems field). I manually commented them out (), Product -> Clean, and I didn't get the errors any more.
I knew there must be bogus references in the storyboard as I had previously deleted my TabBar and the current App worked without problems, just with annoying messages in the console.
I had the same issue. try to
clean
build and run
it worked with me
In my case, it was because Photoshop wasn't saving my files correctly. In the file save dialog I was clicking on myfile.png in an attempt to overwrite that file, and it was saving the file with a png extension, but in photoshop format.
I had to make sure to actually change the file format to PNG before clicking on the file I wanted to overwrite, thus saving in actual png file, thus being readable by iOS. Interestingly, interface builder showed my psd-as-png files just fine.
More generically, make sure your file is, in fact, in the format you think it is and that iOS is therefore expecting.
Solution 1 :
In my case I had copied folder containing images and even checked "Destination : copy items if needed". However it has not been added to "Copy Bundle Resources" of "Build Phases".
You can add images as follows :
Select Targets
Select "Build Phases" tab
Select "Copy Bundle Resources"
Click on "+" (Plus) button just beneath it
Locate images and add it
Solution 2 :
Delete images by selecting "Move to thrash". Again add images in your project with "Destination : copy items if needed" checked.
Note : Make sure that you add images in Assets.xcassets folder and not outside it.
I was getting this error too. I will describe my scenario:
I have a subdirectory "img" which has some png's in it.
One of these png is "ic_timeprogress_000.png"
In the storyboard (visual designer) I had an imageView and the image was set to "ic_timeprogress_000.png" (not programatically). The designer showed the imageView correctly:
Although when running the app, the error was thrown.
So in the storyboard I changed (I insist: not programatically) from "ic_timeprogress_000.png" to "img/ic_timeprogress_000.png", which lead to not showing correctly the image in the designer but showing correctly when running (no error)
Although I alter imageView.image programatically, so this "initial image" isn't ever used.
Check to make sure that canary04.png exists in your project, and that it was not deleted.
My problem was that I saved the image as .jpg and changed the name to .png (was still in jpg format). It worked with simulator
Check your image name. If it contains some spaces then image will show while running in simulator but not in the device. While running it checks Case sensitive name etc.
I had a different problem in iOS 8. In my case the problem was that I selected Device Specific for the image set, and then selected iPad. Changing this back to Universal fixed the problem.
This setting can be found in the images.xcassets file, in the third column show the attributes inspector for the image set.
In this case the images wont be displayed in the storyboard or NIB file even if you have added them to images.xcassets. They also wont show in the simulator or device.
I've encountered this issue when I was trying to set image of an imageView on Interface Builder (.xib) file.
(I was using Image Assets)
I've had 2 images with theImage.jpeg and theImage#2x.jpg
Interface Builder could be able to display true images at compile time with these jpg / jpeg formats. But I've got this error in the runtime:
Could not load the "theImage" image referenced from a nib in the bundle with identifier "org.etc.etc"
Then I changed my image files formats to .png and it worked!
Try this solution too if you have different formats for images you try to set.
I also met the problem that jpeg files cannot be loaded successfully, however I solved it without changing them to png format: for example, if you have an image named "bg.jpg", don't use "bg" in storyboard (this name is listed in the dropdown selection list), instead you should explicitly write "bg.jpg" in the name field.
For programming based image view, I guess using .jpg extension like [UIImage imageNamed:#"xx.jpg"] should also work (I did't test though).
Try cleaning the project and make sure the info.plist matches the xx.co.mycompany.ipad.SplitView
Check the image name. Then check to see if you can open the image itself in paint or photoshop. If the image was created in photoshop and there were layers sometimes there is some conflict with the .png
I had the same issue, if your images are inside sub-folders, you need to choose "Create groups for subfolders" Option when you copy the resources.
I have this problem with Xcode 5, and it seems "Combine high resolution artwork" is the culprit. I opened the app bundle, and all the images were *.tiff, which caused the image to "not be found" :S
FIX:
Open project settings, and search in the top for "combine". Change that setting to NO.
For some reason, everyone is missing this essential fix.
In my case all images where displaying fine on devices with >iOS 7 but not with iOS 6.1.
The solution was that iOS7 is case sensitive but iOS 6.1 wasn't for me. I had images named like "myImageName" and also named "myimagename" witch leads my old iPhone 3 to be unable to display these images.
So renaming them solved it.
Tried each and every answer here and nothing, so here's another glitch, your icon name cannot have dots (.) because if it does (and Xcode allows you to do that!) while the icons show well in storyboard, they won't load either in the simulator or the device.
Maybe after you set the button's image, you changed the image's name.
2015 - Still having this problem. I was referencing an image that no longer existed in one of tabbed buttons.
Solution:
Simply inspect all your buttons, UIImage etc. and make sure that the image that you are referencing actually exists within your project.
I got this problem when I accidentally added another Image set to Asset Catalog file. I renamed it after I realised the mistake, but it doesn't seem to work.
Removing the file and adding it again solves the problem.
what worked for me is making sure the file's owner in interface builder has a "view" outlet.
From IB, select file's owner from "Placeholders", then in "Connections Inspector" make sure the view outlet in connected to the main view of current XIB.
This happened because i removed the main view at some point and forgot to reconnect my new view.
Hope it helps somebody else.
In my case, the issue was the image format. They were 'jpg' files, while Xcode was expecting 'png' files. Changing the file format fixed the issue.