Unused Bundle Resource, not found on disk, after deleting it? - ios

I'm trying to delete all the unused assets, to decrease the app size (icons, launch screens, etc), I started with the iOS project, but now I'm getting errors like this:
Bundle Resource 'Icon-Small#3x.png' not found on disk (should be at
'D:\Work\MyProj\MyProj\MyProj\MyProj.iOS\Resources\Icon-Small#3x.png')
I deleted the specified file, but it's not used in the project, at least it's not visually used. Some of the missed files are the default Xamarin X icons.
I deleted the array items in CFBundleIconFiles key, which pointed to all the missing files, but still getting the same error.

I don't know well about xamarin. But in Xcode, the images files are removed from Xcode better than from Find file utilities.
The project has a directory, .xcodeproj. And a file project.pbxproj will describe how many files will be compiled, and how many images resources in this project.
If a image file was deleted from file system, but it is still in this project.pbxproj. Then the compiler will argue this problem about it failed to find the image resource file.
So, deleting a image file in Xcode, will remove the entry from project.pbxproj and remove it from file system.
In Xcode, it will mark red colors for those missed files, I think xamarin should has similar feature too.

In iOS , some icons are required . Items marked with "Required" must be included.Refer the following image.
As we can seen ,Icon-Small#3x.png is required.It used for seetings on device (such as iPhoneX and iPhoneXs Max).Such as the icon in the following image.
So ,though you have deleted the array items in CFBundleIconFiles key.You will still get the error .

The reason you are getting this error is chances are you deleted the source files, but Xamarin still keeps on referencing them.
So resolve this error go to each folder, Resources and Resources/Drawables on android and delete each image separately. This should fix your issue

Related

How to remove extra linked images in ios .app bundle

When I checked my app size its going approx 120MB right now. Out of which mostly was taken my extra resources. Later on I removed all extras and added compressed version of launch images also 2 extra pods. All this reduced my app size my 30 MB. But still When I checked my .app package contents its showing some extra LaunchImages which I may have added earlier and are still somehow connected to my code. I am unable to find out their source. Please help me how to remove these extra linked images from my code.
Delete unwanted file from bundle resources
Go to your Project settings
Select your application target under Targets
Select the Build Phases Tab
Expand the step Copy Bundle Resources
Remove and unwanted Files that shall not be copied into your bundle
Delete unwanted file from Assets.xcassets
Also, check if your project contains an Assets.xcassets assets library and look if you find your unwanted image within.
Sanity check
When sometimes everything you try fails and Xcode behaves strangely, make sure your problem is not already fixend and only caused by cached resources.
As sanity check you can
Clean Build (Product -> Clean)
Delete Derived Data (Delete ~/Library/Developer/Xcode/DerivedData folder in Finder or via Terminal command rm -rf ~/Library/Developer/Xcode/DerivedData)
Remove App from Device by long-pressing and deleting.
Afterwards build your app again and check if the problem persists.
Remove the items from Assets catalog if it is an image.
Remove unwanted files from respective directories.
Remove the Derive Data.
Clean the project. Then archive.
How to remove Derive Data:
Xcode-> Prefrences-> Locations-> Derive Data.
Remove content of Derive Data folder.
iOS 9 has got a new feature called App thinning. Xcode and Appstore handles downloading of images that are relevant to specific iPhones thereby reducing the size of the app. You can just enable App thinning while moving your App to the Appstore. This is one of the method to reduce your app size.
you can check this App thinning

How do i fix this CopyPNG File error?

While reading /Users/user/Desktop/AppProject/PruebaApp/Logo Retina.png
pngcrush caught libpng error:
Read Er Could not find file:
/Users/user/Library/Developer/Xcode/DerivedData/PruebaApp-cblepoaxbqzyopcbcswwqjtftyon/Build/Intermediates/ArchiveIntermediates/MaderoAPP/InstallationBuildProductsLocation/Applications/MaderoAPP.app/Logo
Retina.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
Im getting these errors while archiving project, at the end it does archive but i want to get rid of it. I had trouble with the app before and i read that i should delete the DerivedData/(myproject)folder so i did. and apparently it is trying to look for the images in that folder how do i fix this??? Help!
Try first by Hard Cleaning your project CMD+OPTION+SHIFT+K, If problem exists apply following method,
Build Phases -> Copy Bundle Resources, Any fileName is red color?
Or
Convert Logo Retina.png or Create it again, maybe it's an encoding\format issue.
Or
Rename "Logo Retina.png" to "LogoRetina.png".
~Good luck~
It also happens when you have multiple images with the same name in TARGET->Build Phases->Copy Bundle Resources. To resolve it -
Search for the image name that you are getting an error for in Build
Phases search bar at the top.
If you get multiple results in Copy Bundle Resources for the search query, just remove others from it by clicking on "-" sign. Make sure you have same images for the multiple results. If not you have to rename the actual files of other entries.
Just compile your code. You are good to go.
Hope it works for you.
Just open image in Preview app and export it as png file. Replace old image with new in Xcode.
Honestly I have had this problem intermittantly many times and clean then rebuild has fixed it.
Since the answers here are either not useful at all or quite complicated I want to add mine:
The error means that Xcode can not find the file, whether it is in the project's folder or not.
If you still need that image, what you can do is to open a Finder view and navigate to your project. Drag the file Xcode was complaining about into the project an uncheck 'Copy to folder'.
if you do not need the file anymore, on the left side of Xcode, find the file, it will be shown in red, simply tap on it and then delete / backspace
Hope that helps some people :)
To solve the issue copy the Image name. Then Filter it (Build Phases -> Filter textfield). Finally I removed it.
Also check that you are not naming the images with only a number like "0.png" I change it to "tuts0.png" and it worked.
I just had this error and honestly I think it was being caused by another error. I had an issue with my Crashlytics framework and I'm convinced it was effect some unassociated pngs with the copypng error. I replaced the Crashlytics.framework with a fresh version and viola, all errors were gone.
Don't ask me how this works, I'm just posting this in case someone else can benefit from it.
I wasn't able to fix this problem. So i delete and reinstalled xcode, this helped for me.
Fixed it by reverting to my old product name (in "Build settings"). Seems that the new product name confused the images path.
I have the same issue with resources. The problem was that I have copied target from another one and just forget to uncheck checkbox at target membership window.
i face this problem and this solution is working form me
you need to remove any reference for that image
Build Phases -> Copy Bundle Resources
after that clean and build and problem will be fixed
I had accidentally deleted the file from the location which was linked to x-code project. I had not copied the file in my xcode project but just the path. Hope it helps someone.
I've had similar issues with pngcrush /libpng crashing with PNGs (checksum errors / freeing object that have been freed etc). These could be reproduced on the command line so I recreated the PNGs, even converted them to other formats then back but the errors persisted. In my case Xcode then rejected the resulting archive for not having iPhone 5 support (as pngcrush killed the Default-568h#2x.png image). The above fix resolved this.
For those who are struggling with this error while building Cordova app.
Please keep the following point in consideration as it may lead to this error.
The images should be tagged as "resource-file" and not as "source-file" in plugin.xml of your Cordova plugin as the former includes the images in "Copy Bundle Resources" (under Build Phase) and the latter to "Compile Sources" of your equivalent xcode project of cordova app.
If non of above answers can fix your problem, try look into Xcode project where you reference your image file, I happened to referenced twice to the same png file. Once I delete one the reference, it worked. The error went away. Good luck.
It also happens when you have multiple images with the same name in TARGET->Build Phases->Copy Bundle Resources. To resolve it -
Search for the image name that you are getting an error for in Build Phases search bar at the top.
If you get multiple results in Copy Bundle Resources for the search query, just remove others from it by clicking on "-" sign. Make sure you have same images for the multiple results. If not you have to rename the actual files of other entries.
clean cmd+option+shift+k and Build Project...
work well for me....

XCode adding duplicate and incorrect icon filenames to Info.plist

When I run the XCode 'Archive' command, I get seven error messages about missing files. Most are for the launch files that are supposed to be there, but one contains the misspelling "Portait".
warning: Icon specified in the Info.plist not found under the top level app wrapper: Default-Portait~ipad.png (-19007)
Unable to validate your application. - (null)
I did enter that filename by mistake several months ago, but I thought I expunged it from the project. Here is the 'Info.plist' file for my app. Note that it has no icon entries, other than Icon file.
Here is my Target Summary. I have launch images specified.
When I look at the 'Info.plist' file within the newly created archive, it contains a whole list of icons. I've showing Icon files (iOS 5) here, but the list is duplicated under Icon files. The "Portait" misspelling is there, as are several duplicates. It's mess.
I know that XCode automatically generates some content for 'Info.plist', but where is this long list of filenames coming from? And, how can I prevent them being generated?
What I Have Tried
I have run 'Clean' and deleted my XCode 'DerivedData' directory, but the warning messages and spurious Info.plist entries persist.
I checked the localized 'InfoPlist.strings', but it only contains the line /* Localized versions of Info.plist keys */.
I looked through the contents of my '.xcodeproj' package, but found no mention of the files it's trying to find.
I tried adding an empty array of icon files to my 'Info.plist', or adding the names of the exact files I wanted. The bad and duplicate names still get appended to the end when I Archive.
I tried duplicating the Target (which, as usual, duplicated the existing Info.plist file). Archiving the new target resulted in the same error.
The Build Setting Preprocess Info.plist File was off. I tried switching it on; it made no difference.
I tried switching off the Build Setting Expand Build Settings in Info.Plist File. It told that I was trying to run the file '${EXECUTABLE_NAME}'. I went to my 'Info.plist' and changed Executable file from '${EXECUTABLE_NAME}' to a hard-coded text value, and also manually replaced the other '${...}' entries. Despite this, it persists in trying to run '${EXECUTABLE_NAME}'. Possibly whatever is adding to the icon settings is also overriding my executable name.
What I Would Rather Not Do
I could probably suppress the warning by adding files to the project with the names it expects, including Default-Portait~ipad.png. I'd really rather stop it these names being added to 'Info.plist' in the first place, since those duplicate entries could cause other problems down the line.
Other Details
This project was created in early 2011, and has been progressively migrated through newer versions of XCode. It is currently open in XCode Version 4.3.2 (4E2002).
Found it: choose a Target and go to the 'Info' tab, and you get something that looks like 'Info.plist'... but changes made there can override your Info.plist. This was especially confusing because I had intentionally made multiple Targets share the same 'Info.plist' file, to avoid needing to make the same change in multiple places.
I would still welcome an explanation of where these settings are stored within the '.xcodeproj' package.
I have the same issue -- Xcode did this to me for a new project. My info tab on the target shows the same mess. I guess I will check for updated iOS6 docs and edit the entries here to the best form.

Archive app with Xcode 4.3.1 gives pngcrush caught libpng error:

The app builds fine in a simulator and on a device. But as soon as I try to archive it for submission I get:
While reading /Users/adga/Documents/Adams Lokalt/Appar/NU SÅ/VertragingsApp/Rotation/Customization/Herfst2011/../../../default#2x.png pngcrush caught libpng error:
PNG unsigned integer out of range.
I've tried to open in photoshop and replace (without interlacing) but it doesn't work.
Any ideas?
I receive such error when just try to run my project.
This error could occur when you have duplicate file references (I have this problem because I change my png images). You can check, all of your copying files in Bundle Resources and for me there was more than one copy of each "error png file".
You can open Bundle Resources following this steps: click on your project name in Project Navigator tab, then choose your project in Targets. After that, you must choose Build Phases tab. You'll see a list of items: "Target Dependencies", "Compile Sources", "Link Binary With Libraries", and what we're looking for Copy Bundle Resources. Here you can see all your resources that you add to your project.
To fix this error, you must remove all error files from this list.
After that you also delete this files in Project Navigator, choose all files that needs to unlink from project, than right click on them and choose delete, then choose Remove Reference. All we need is to remove all references from our project.
All things done, right now we must add our files back. Click to Project Navigator zone with right button (or to a particular folder/group) and choose Add Files to "Your Project Name" and choose all files you need to delete.
Remember, that you remove reference from files previously and they are just waiting to be added again in your project folder.
Another reason when such error occur is when .png file is not a proper .png file, in this case you need to re-save file to png extension. You can open your image file in Preview and save it to png from here. If you have a big amount of images, you can use Automator to help you in your task. Hope this help.
I faced the same issue as well. I just restarted xCode and recompiled. I did not have that problem thereafter.
I met this problem too. Though the project still could be compiled, it is really annoying.
I resaved the png without interlacing to another place and replace the original one instead of just resaving it at the original place. This did work for me, why you just try this again?
I received this problem when I added two images to a project that already had references to them. Once I removed the duplicate reference, the error disappeared.
I had the same problem and error disappeared after simple step in photoshop. Open your existing png file with photoshop and re-save it as "Save for web & devices"...that did the trick for me!

iOS Can't read file

I have a strange problem in my project and can't figure out a way to fix it.
It manifest itself when I Archive the project. If I just build it, all is OK.
This is the error I get...
While reading /Users/jorgen/Desktop/isengua-en-de_120125/Airship/UI/Default/Subscription/Resources/Shared/middle-detail#2x.png pngcrush caught libpng error:
Read Error
However the actual file that it can't read changes. I have checked that it there and that it can be opened. It is always the Airship files, but it can be in Push, StoreFront or Subscriptions.
Also in the same project I have a problem with the icon.
warning: iPhone/iPod Touch: isengua_ENE-DE_114+.png: icon dimensions (0 x 0) don't meet the size requirements. The icon file must be 57x57 pixels, in .png format (-19014)
Unable to validate your application. - (null)
The icon for Retina is 114x114 and the other is 57x57. Again I have checked and double checked this.
I have gone back to a copy I had two weeks ago, and the same thing happens.
Grateful for any help.
If it only happens when you archive then the error happens when attempting to package/move all the files required into the the archive folder. Building just pulls from the referenced location.
Easy fix is just remove the files and re-import. 2 files would no be a big hassle.
Also you could peek at your info.plist and/or your copy bundle resources and confirm that everything points to the right files.
None of the answers worked for me but this did.
I check in the resources folder i.e. not the www folder, so:
PROJECT-NAME/PROJECT-NAME/Resources/splash
in that folder there should be a copy of the same Default.png and Default#x2.png that are in your www folder.
when i checked they were the phonegap defaults. I replaced them with a copy of mine from the www folder. Did a clean and a build and it finally worked!

Resources