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.
Related
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
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.
I am trying to update an Xcode project. The update is to replace an image that is displayed in a static window. I replaced the image being called, the new image has the same name and size, but when I open the window, the image does not fill the entire window like the original image did. I a new developer in general, but a total newbie when it comes to XCode. Any help would be appreciated.
Replacing an image file in a Xcode project can be done as:
Go to File in Xcode using the Project Navigator.
Right click the file and pick "Show in Finder"
Drag new file into as same folder as the old file. (make sure the old file and the file have the same name)
Say yes, you want to replace the file.
And your done.
Compile and run will show the new image. I've done this hundreds of times, usually updating placeholder images and never had any trouble.
As for your particular problem, you didn't describe the steps you used to replace the image, so I can't testify on that, but if you do the above and don't get the results you want it's going to be from a bad image file (different size, etc).
I have run into an incredibly frustrating issue. I wrote an iPhone app on one computer, and now I am trying to work on it on another computer. I zipped the project, and sent it to myself, but when I open it, it seems that none of the images came with it. When I was adding the images, I always checked the box to have the images get copied into my project. All the image files show up, but they are in red.
I tried fixing the path of one of the hundreds of images, and after doing that, the image appeared in the typical color scheme of xcode in my project. The problem was when I tried to run the code, xcode said it couldn't find the image I'd just imported.
Next, I deleted all the images, and tried importing them again. Once they were imported, they all turned red again.
Has anyone else run into this issue? Help!
In Finder go to where the actually code is, and see if it did in fact move the images into the project structure.
When the resources are red inside Xcode it means Xcode can not find them you can right click on them and see where it is expecting them to be located. You can also do this after you import images to make sure they are in the project structure.
Usually XCode folder structures have a "resources" folder off of the root of the source code, this is where you should put all images. I usually manually copy them in there, and then just import them into XCode from there.
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