Removing Old JPG and MP3 Files From Bundle - iphone

I think this is very basic, but still, I didn't understand what I should do here:
In my app there are many JPG and MP3 files stored in the app bundle; they are triggered and displayed upon user actions. When I change a certain file (for example, I had a photo and I wanted to change it to a new photo with the same file name instead of the one I had), I delete it from the bundle (selecting "Also Move to Trash") and then insert the new file.
In some cases (not always) the old file is simply not disappearing (!?!); If I look in the bundle I see the new photo, but when I run the the Simulator I still see the old photo (same goes with mp3 files).
anyone?

When Installing app in simulator, Xcode doesn't delete old files, which can lead some troubles like this. Just make sure to :
delete app from simulator
OR reset simulator
OR (the one I prefer) delete app directly from ~/Library/Application Support/iPhone Simulator/_version_/Applications

maybe you should delete the app in simulator and re-install it to simulator by Xcode.

Build>>Clean & Build>>Clean all targets will solve your issue.
Do these two things and then compile and run the app and you'll see the changes.

Related

my text files no longer in project still show up on phone

I am getting old files in my documents directory and not sure why.
On the simulator it works as expected. I can update the files no problem. I just delete the app. from the springboard and rebuild. I can easily verify the files are the correct ones.
But, when running on the iPhone, old versions of the files show up. I do always delete the app of course. And if I go to the project and delete the files and verify in the build phase that they are not included, they still show up on the iphone.
I have rebooted the mac and the phone, no change.
I even found under organizer how I can download the files from the iPhone and they do show the old files, but I am not sure how they got there as I don't think I am asking for them to be copied...
thx for any suggestions!
After finding the compile output, I saw that xcode was copying from a directory called "DerivedData" and then I found posts about possible issues/bugs.
Here is a link to the fix

Xcode png image reference

I have made a project in xcode 3.2 after some time i upgraded my xcode in 4.2 every thing works fine. now i want to set up my project on another mac laptop having same environment. but during build it give me an error ie
CpResource ../../Desktop/th_text-field.png error: /Users/gchauhan/Documents/project backup/30july/lisnxios_lisnxios/Lisnx/../../Desktop/th_text-field.png: No such file or directory
while this th_text-field.png is not present in my xcode project. i don't how it is happening please some one way out of me from this problem. i will highly thankful
In you 3.2 project you must have added a referece of this png but not copied.
Remove reference and then add again now make sure copy item into destination ... is checked like below
Thats normal. That image does not exist on other computer, so program can't find it. Always add images to your project bundle, so that it could work normally at other computers. I think even if you would add sandbox to your app it couldn't access image if he is in other directory, such as desktop or something like that. Music, Movies, Pictures and Downloads folders are easily accessable easy after sandboxing. To access other directories is alot of work to deal with sandbox. And you will need it if you are going to submit your app to appstore. And now, if that file doesnt shows up in xcode project's files list, then just add image (drag and drop) to your project files list and in window witch pops up, put tick on "Copy items...." and be sure that in "Add to targets" your app is ticked.

Iphone app not showing properly on the device

i have an app which works perfectly on the simulator but on the device in is not as expected.
Animations are misplaced and other bugs. But on the simulator it works fine.
My question is how to fix this bug.
Here is list of things I already tried:
Restart Mac.
Restart Xcode.
Clean Project.
Rename Project.
Delete app from iPhone.
Restart iPhone.
Shut down iPhone.
Clean and build in Xcode.
I really don't know where is the problem.
Thank you for your help.
Would be really appreciated.
Notice: App is correctly signed.
Make sure your files typed correctly and are case sensitive. The Simulator is not case sensitive but the iPhone is.
Did you ever move code/xib files into different groups or directories? Sometimes there is a old copy of the file in the original directory after the move. I've had scenarios in which those old files caused the old code to executed when switching between build settings.
If there are duplicate files, make sure you delete those copies at the old location, or those that you don't intend to be used. For instance, if your original directory as ~/Work/App/Resources and the new directory is ~/Work/App/Resources/xibs then delete the duplicated files from ~/Work/App/Resources
Make sense?
Now, after deletions, if files start to show up as red in XCode, that means XCode cannot find them anymore (maybe you deleted one too many, or who knows the state of your workspace). If this happens, use the "File Inspector" to confirm that the location and path XCode is using for the file is correct.

Why isn't my iPhone app bundle replacing the old one during an update?

I'm starting with an app that has foo.png as a resource, and the app is installed (either in the simulator or on the device). If I delete foo.png, do a clean build, etc., and install, then it still shows up in the bundle on the simulator or device!
But I know the file isn't in the bundle before copying to the simulator or device (for example:
I can see it's not there in the build folder.
If I delete the app from the simulator or device, and then install, then foo.png doesn't show up on the simulator or device.
So it seems that when updating, it doesn't replace the app bundle; instead, it only copies new files and replaces updated ones. (I can confirm that it does, in fact, copy and replace files properly.)
Why isn't it replacing the entire app bundle?
If you update your application through iTunes using an ad hoc build you will see that your .app bundle will be replaced completely and old resources, such as the foo.png file described in the original post will be removed.
Reset the simulator, go up to the menu and then click reset simulator. I always have that problem with databases on the device. You will have to delete it on the device. Just a quirk that I've experienced as well.

XIB actualization problem

I'm facing a weird problem dealing with Xcode. When I run my project using simulator I got the correct xib showing, but when I select my iPhone as target, it shows an older version of that xib... I'm going crazy with this, I have tried to clean targets, deleting and reinstalling the app on iphone, :^S
Please could anybody help me with this issue?
Thanks a lot and sorry for my english.
When Xcode installs development builds of iOS apps on the simulator and on the device, it copies all files from the .app bundle into the target directory for the app in the simulator or on the device. However, it does not remove old files. This can sometimes cause strange effects.
For example:
You have MyView~ipad.xib and MyView.xib for iPhone, you install the app and run it on the device, now you decide to delete the MyView~ipad.xib so that it will just use the MyView.xib same as iPhone, you test this in the simulator and it works fine but when you put it on the device again it still uses the old iPad xib file, but how when it's not even in the project any more? Well the old file still exists in the filesystem on the device until you actually delete the app off the device.
This can happen when you remove files from the project or rename them to something else, the old files will still be there and especially if you have fall-back beaviour or how iOS can look for other suffixes automatically like #2x or ~ipad - this can easily cause confusion. Check for this whenever you notice strange effects like old versions of files seem to resurrect themselves, or it works on one device but not the other.