How do I remove unused image from my xcode project? - xcode

When I delete images using Delete. It has two choices.. remove reference and move to trash.. when I choose move to trash, the image is removed from the list. But when I hit run, the image is still attached to the running app? Why is that? can someone help me with this issue? I want to remove it completely from my app.

Try closing the Xcode and Simulator and then Run it. Also try to remove Background image name from the Attributes Inspector. This might work

Related

Remove image reference from Xcode

I removed a few images from my Assets.xcassets folder but they still appear referenced when I want to change the image in an image view and I get a warning about the images. I did clean the project but still the same problem. I can't remove the entire assets folder in the build phases because i have other images that I use.
What can I do?
Just ignore it. That reference will disappear the next time you open Xcode or reboot OS X.

Xcode 7.0 The launch image set "LaunchImage" has 2 unassigned children

I just updated xcode to 7.0 and fixed most of the bugs, but I keep getting this error message:The launch image set "LaunchImage" has 2 unassigned children. I already deleted the two unassigned children and still getting this error message.
Try to deep clean Xcode (command+alt+shift+K)
If you click the problem , Xcode will lead you directly into the
Images.xcassets , manually delete the two Unassigned images , rebuild it work fine for me.
The deep clean didn't work for me. As trivial as it sounds, recreating the LaunchImages fixed the issue for me. I don't know why it happened in the first place, probably an Xcode 7 bug, but it works again.
What you have to do is manually delete the two unassigned images, and then right click your image asset panes and choosing: App Icon & Launch Images > New iOS Launch Image. Once you click on that, a new set of launch image screen slots should populate. See the screenshot below for reference.
In my case deep clean would not work until I manually deleted both unassigned images. For me the fix was a combination of all three answers above.
Select the image. Open the attributes inspector and check that a device has been selected - i.e. all/universal. Then drag and drop the unassigned image into the appropriate image size.

Any explanation for wrong images showing up?

Some background. Until I redo this part of the app, for now, I've dragged a bunch of images into my project. They are called Landscapexx.jpg and Portraitxx.jpg, where xx is a number from 0 to the total number of pictures (minus one) for that orientation.
At some point, I replaced the images used in the project. But the original images are still showing up on my device (but not in Xcode). Using NSLog to confirm which image is being loaded, I then look up the image with the same name in Xcode. Sometimes it's the same image. Sometimes it's not.
At first I thought the problem was that when building the app again the data remained. That would be a reasonable explanation. However, when I deleted the app, acknowledging that the data would be deleted, that did not solve the problem. Could this be a cache issue? If so, how do I clear the relevant cache?
One last thing. The images that appear incorrectly on the iPad have the project name checked in the file inspector.
The way I'm loading the images, by the way is using NSString *newImageName = [NSString stringWithFormat:#"Landscape%d.jpg",n];, for example. So the file simply needs to be in my project space somewhere, I thought. If there are two copies, I have no idea where the second one would be. I don't see them in Xcode.
P.S. If I run the app in the simulator, I get the same images as on Xcode. This suggests the errant images are cached somewhere in my iPad. Since deleting the app didn't take care of the problem, is there something else I can try?
EDIT: I found something that may point to an issue. If I go to the Build Phases screen and open the Copy Bundle Resources item, all the images are listed there. However some of them don't have the ...in projectname after them. These same items have the project checked in the file inspector. Not all the images are this way. What do I need to do to ensure all the files are correctly in the project?
I suggest deleting the app from the phone, cleaning the project, and rebuilding the app. This happens to me on occasion and this usually fixes it.
I figured it out. Going through all the menu options in Xcode, I found an option called Clean in the Product menu. I selected it, rebuilt the app and all is fine now. This option apparently clears out the precompiled stuff that occurs the first time a project is built.

Batch add images to Xcode while avoiding crashes

If I try to add a group of images in one shot Xcode crashes. Normally I solve this by (annoyingly) adding files one at a time. But I'm currently in a situation where I would like to add ~600 images in one go. Anyway fail safe way to do this?

Image does not update when file name remains the same in XCode 3.1.2

I'm using XCode version 3.1.2 and am developing for iPhone using the Simulator with iOS 2.2.1 on Leopard. I had an image file named "img.jpg" in my project which I decided to switch for a different file. After adding the new file into the XCode Resources folder, I removed the first file and renamed the new file to the same name as the previous one, "img.jpg." When I run my program, however, the Simulator loads the old image instead of the new one, even though the old one has been deleted from disk (not just the reference). I tried changing the name of the file to "img2.jpg," and it worked like it should - loading the new image, but I want to keep the name "img.jpg." I ran a search with Spotlight for "img.jpg" to see if there was another copy stored somewhere that XCode was using, but it only returned my new image file. I have tried uninstalling the app from the Simulator and running the application again, but that also does not fix the problem.
What must I do for XCode to recognize that I want to use the new image file and not the old one?
Thanks for your help!!
You should clean build all your XCode Projects Targets by using "Build" -> "Clean all targets", and rebuild from scratch. This should fix your problem.
If you have a big project and don't want to wait that long, you can also remove and re-add the file reference from/to your project. That seems to always work.
You have to solve it by performing both routines:
Read the new images into Xcode
Product > Clean
Secondly update the simulator
You also have to force sending the updated images to the simulator.
You can do this by deleting the folders, or just removing the app from
the simulator (as you normally do on your phone).
I had this problem in Xcode 4. The problem was caused by a Default~iphone.png hanging around with the old image. I saved the screen shot over Default~iphone.png and chose that file as the launch image in the project summary page. You can tell if this is your problem when you select the Default~iphone.png file as the iphone launch image and xcode asks you if you want to overwrite Default.png.
An important addition - when working with Simulator, delete the folder in the Simulator
The folder must be named something like
/Users/username/Library/Application Support/iPhone Simulator/6.1/Applications/53630E9A-6E04-4D33-8600-AD29484C9FA8
and have YourAppName.app inside

Resources