How to force application Settings bundle get updated? - iphone

Application Settings.bundle contains a version number, which is automatically generated during build. From build log I can see that new value is written there, also when looking inside the file itself in MacOS X Finder I see correct updated value.
Settings in iPhone simulator or in real iPhone shows me the old value. Removing application and reinstalling is so far the only way I've managed to get the new updated value visible.
Question: how can I force iPhone Settings application to read my new latest updated bundle file?
Some background info, which might or might not be related: I install application only via Xcode into both simulator and iPhone. Is this the problem? Just found this in Apple docs, not sure what it actually says. Seems to contradict itself (last chapter)...
Each time you reinstall your application, iPhone OS performs a clean install, which deletes any previous preferences. In other words, building or running your application from Xcode always installs a new version, replacing any old contents. To test preference changes between successive executions, you must run your application directly from the simulator interface and not from Xcode.
So Xcode always replaces old content, but to test changes I cannot use Xcode? What was that? Done both (after installation via Xcode) and didn't see new values in settings. Any ideas how does it actually work? Do I always have to make non-Xcode installation?

Try cleaning and building. It seems that xcode caches dates and doesn't notice the change that your script is making. I've had similar things happen, clean always fixes it, but it is indeed a nuisance.

Make sure to shut down the Settings app running in the background on device. It looks like Settings caches settings while it's running - but pulls the updated values when the Settings app is re-launched.

In my case, it seems that my modified root.plist, created/edited via the Xcode property list editor, just wasn't being saved.
There was no problem at all with the Settings Bundle being copied over to the iPad. A quick cmd-S followed by a rebuild and go/debug updated Settings on the iPad straight away - no app uninstall/reinstall even needed. You'd think there'd at least be a haven't-saved-it warning from Xcode, as there always is for code source files.

I just tried this and it worked.
In Xcode go to : Window->Organizer,
then view installed apps on the connected iPad/iPhone, remove the app, then recompile and run your app on the device.
I think the issue has something to do with the iPad's cache.

Related

XCode error "The application bundle does not contain a valid identifier."

Recently, after upgrading to Lion and Xcode 4.2.1 I am getting this error when trying to run my app on my iPhone 4S:
"The application bundle does not contain a valid identifier."
My identifier is indeed valid, and I have been able to run my app with this identifier earlier.
The problem might appear when I change computers.
I have two computers that I am using to code my app, and I am using Dropbox to keep track of my files.
Restarting XCode, my mac and my iPhone does not work.
Cleaning the target and rebuilding does not work.
The only thing I have been able to do to fix it is to create a completely new project and moving my files. This made things work until I swapped computer. Now I am in the same trouble again.
Any idea? Anyone?
Three suggestions:
Check that your developer key is in both computers
Did you try to update the project? There is a strangly-named key in the middle bottom under the project's properties. Try this.
I had similar issues. I found that some things weren't updated when I updated osx and xcode. To get out of the situation, I would suggest creating a new project and copy paste code, files and build settings. This might seem stupid, but you know apple is not good at creating IDE's. You might just get your self lost in the undocumented settings.

Xcode 4.2 not debugging properly

I've imported an iPhone app that I have developed for iOS and am now maintaining it. I've came across a couple of bugs when trying to add to the iPhone's calendar, which I'm happy to try and sort out myself with a bit of debugging.
One problem is that when I go to run the application on the iPhone simulator, it seems to run an older version of the app than the one I am running. I've removed and added another button since then and the old button is still showing when I run it in the simulator. However, when I compile and run this on a device, it loads the correct version and displays the correct version number in the 'about' view.
But... my main problem is that it doesn't seem to debug on the device properly. The app actually works fine except for the calendar problems, but if I put a few breakpoints in so I can see exactly where this is going wrong, it just doesn't seem to step through! The app pauses, and Xcode says the app has paused! I can press step over and continue execution etc and it appears to work, but I can't see it stepping over the code, nor can I hover over variables to see their values.
I've tried reinstalling Xcode multiple times (I did have a problem installing an older version, so I had to wait until the next version was available before Xcode would install).
The stress is: Today is my last day at work, and I'd really like to get this app ready for iOS 5 before I leave.
Has anyone seen these symptoms before? Is there a debug setting that I've missed? Or is it a corrupted installation?
I wish I could help people a bit with more information, but I don't even know where to start looking here. Any code I can post? any settings? (not too familiar with this, I'm a .NET guy usually).
Thanks!
Sorry you're going through a tough moment there Connell; as you said you're not too familiar with all this, I'm laying down a few steps which might help you out. Some are pretty basic, yes, but I've resolved to these steps myself several times when I've encountered similar scenarios;
If you're testing on the simulator, do a 'Reset Content and Settings' from the 'iOS Simulator' main menu. This will remove all old data and settings and give you a clean start.
Do a 'Clean All Targets' from the Build menu. Then go to your physical project folder and delete the Build folder from it altogether before starting to build again.
Restart both XCode and the Simulator (and your Mac too if possible)
Make sure the mode is set to Debug and not Release or Distribution
Even on the device, remove the old app before putting the new one in, and restart it for good measure.
Delete all Provisioning Profiles from the device and install just the one you need.
On the code;
I've noted that the app appears to 'pause' like this a couple of times when I had accidentally created an infinite loop in the code. Double check to see whether there's something which may cause this.
Unless you haven't already done so, throw an NSLog or two in there to see if its really not being executed beyond the breakpoint.
I've had the exact same problem with a project that I started on xcode 3 and then switched to xcode 4. What fixed it for me was changing the compiler in the project settings.
The default compiler up to xcode 3 was gcc, while the default compiler on xcode 4 is LLVM gcc.
Now, I don't know exactly what's the issue that gdb could have with LLVM gcc, but switching the compiler back to gcc in my project settings and doing a clean build fixed my debugging issues.
Might be worth a try.
Have you checked which debugger is being used GDB or LLDB? Select Edit Scheme from the Product menu, and see what the Debugger setting is under the Debug scheme. You could try switching between GDB, LLDB, and None and running in between.

project always running with old code

I was trying to try out and create a .app file for my application and so I followed a tutorial.
After doing this and running the app again on the simulator it always runs with the old code that I have. Why is this? I tried reverting everything back again, but it just won't.
I tried printing something when the app loads, but the app that runs didn't print anything
UPDATE:
I found a fix which is to revert back my bundle identifier to the old one. Why does this work? What if I want to create a binary again to be distributed in the app store, what should I do from this point?
You probably have two apps with the same bundle identifier on the simulator, and Xcode starts the wrong one.
Try to delete everything from the simulator.
Open the iOS Simulator menu in the main menu and select Reset Content and Settings...
I've had the same problem before and for some reason it just didn't update all the files in the bundle that it deployed to the device/simulator. Just delete the app from the device/simulator and redeploy. When it happened to me it didn't create a second app it just didn't completely update the bundle.

How to get rid of old Localizable.strings?

So I have this app that is already on the app store. To get support for multi language localization we recently changed the localization configuration.
Old configuration:
./Localizable.strings
New Configuration:
./Swedish.lproj/General.strings
./Swedish.lproj/Localizable.strings
./Swedish.lproj/Settings.strings
If I remove the old version and install the new one everything works as expected, but if I leave the old version on the phone when I install the new one, the translations in ./Swedish.lproj/Localizable.strings won't be visible. So it seems to me like the old ./Localizable.strings is still left on the phone, hiding the new ./Swedish.lproj/Localizable.strings. The translations in ./Swedish.lproj/General.strings and ./Swedish.lproj/Settings.strings both works.
My fear is that if we release the update as is the users would be forced to uninstall the app before installing the update to get the translations to work, which would mean that they lose all their saved data. So you can see why this issue has high priority.
If I have understood the cause of the problem correctly, my question is how do I get rid of the ./Localizable.strings already present on the phone? The more general question would be how do I solve this problem?
Are you testing this in debug mode and Xcode is installing the new binary onto the device/simulator or are you doing an Adhoc build-and-archive and then test the update via itunes?
I know that xcode at times will not overwrite files when doing an build and run in debug mode. A touch of the file will not help, but only a clean-all, exit and restart of both Xcode and simulator cures it.
If you are using the adhoc build then the complete app bundle sould be overwritten. If this is not working something serious is at fault.

Settings.bundle Not Appearing on Application Updates

I have an app that does not currently use a Setting.bundle to display setting in the iPhone Settings app.
I am releasing an update that does.
On a fresh install, the settings are added to the Setting App as expected, but upon updating from the old install, the bundle is not added.
Is there some sort of trick to get the Settings App to show my Settings.bundle?
It turns out a full clean did the trick. I think the bundle gets cached somehow and even on changes, Xcode doesn't recognize it changed sometimes.