Distinguishing between iPhone app upgrade and app new install? - iphone

There is a situation that I am faced with which seems like it has no solution. Here it is:
I have an app on App Store. I didn't write any piece of code for this app keeping the upgrade scenario in mind. For all I could imagine, I never that I would be giving out more versions apart from the one I already have on app store. Now, the situation is that I am required to give an upgrade of my app and with in the new code, I am to identify if it is a new install of the latest version or if it is an upgrade from the older version. I don't know how to approach this as I have not coded my first version appropriately for upgrades? Anybody willing to enlighten me.

See previous thread here iPhone: How do I detect when an app is launched for the first time? I use this in just your scenario and it's fine to introduce it with the update - it copes with the previous version doing none of this.

Related

How to simulate the AppStore update process on device/simulator

We have submitted an update version of our existing applications in the App Store recently. But we have received a issue from one of the users, saying that the app is not functioning properly after the update. So in order to replicate the same, what are the steps to reproduce, so that i can analyse the issue?
Any help will be appreciated.
To simulate this before pushing yoru updated version to the AppStore you can:
Download the old version of your app from the appstore
Run the updated version of your app from XCode on the same device.
What will happen behind the scenes is that your app will be updated in a way similar to the Appstore. Your app will be partially updated while your doucments folder will stay the same. (what usually causes problems)
This solution is better because it lets you check for problems before and update was pushed to the Appstore.
Yeah, I get this a lot. The solution is a bit annoying, but you need to keep a history of IPAs you've submitted so you can put the on your phone through iTunes (so not the simulator) and then, run your code on your device putting a breakpoint on your applicationDidFinishLaunching handler in your app delegate, and start tracing from there. You should be able to find the old app store version in your organiser from the last time you submitted, or, go through your SVN/GIT history and checkout the version tagged to your release version.
Many times in the past that has happened to me where I test a new revision and everything looks fine but when I submit an update and is approved, users start complaining about a crash or lost data.
This is way I approach the problem.
(This is most important step) You need to either have your old code or old binary installed on your actual apple device. (Physical iPhone / iPad)
Now go to iTunes and install your new update.
Attach your physical iPhone / iPad to you computer, Launch Xcode and start debugging it.
NOTE: There have been many times when things work perfectly in the Simulator but break on the actual device. Its always important to test your code on the real thing as that is what the users are going to be on.
All that is required is to have the version of the app that is in the app store on your device, then install the updated version to your device. You can debug it using Xcode when you install the new version.

Test If Version update works fine

Some days back i had few problems regarding the version updates from iOS 4.0 to 6.0 . The entire database was cleaned when the new version was installed .
Is there any way I can test version update before submitting to apple ?
I tested version updates via
Hockey
AdHoc build installed via iPhone configuration utility.
Is there any other way i can test the things so i can be sure that the update will not have any problems?
You can test it via TestFlight service. It's a great tool and I use it often to test my updates.
On a fresh phone (or a phone that does not have your app on it), download the current version of the app from the App Store. Setup all the necessary data, create values in your database, etc. Then update your app in the phone via adhoc release or TestFlight. The key point is to have the most up-to-date public version of your app first.
Try out Crashlytics. It provides instant and detailed crash reports, right down the line # at which a problem occurred.
It negligible in size (a few hundred KB), but even works on release distributions! That means even if you miss a few bugs, you will be notified instantly the moment a crash occurs, rather than having to wait for the useless Apple Crash Reports to be published.
Hope that helps you out a bit.

Problem in updating app on iPad

I created an app for iOS 3.2 for the first version 1.0.
Recently I created an updated app for iOS 4.2 with print feature etc. for the second version.
My problem is that, the users are not able to update the app from appstore.
They are facing issues like data loss of version 1.0 app, crashing etc.
Can someone explain me what can be the reason for this?
And, how can I test this thing on my device, as I am not having the version 1.0 app from appstore, but the code for both versions.
Delete your new one on your test device and install the old one. Then build and debug the new one line by line. I had lots of trouble my first time through due to confusion over the update/migration process of core data. If you use core data, chances are your existing customers have an out of date store DB that your new code is crashing on. The store doesn't get wiped in an update if it's in your user's document directory... Only the one in the app bundle. You'll need to handle that reset or tell core data to migrate it to the new model. Of course, all this is speculation since you've given almost no details about the problem, frameworks used, log files, etc.
During a normal install process, data should not be overwritten. NSUserDefaults and files should remain during an upgrade, as long as the user doesn't delete the app first. I assume the crashing occurs after the new version is installed?

What happens to existing iOS app when I update?

I have, after many months of work, finally got my app updated for iOS4.
The first release was complied for iOS3.2 and has been in the AppStore for a while, I was very impressed to see it continued to work and be downloadable for iOS4 users all this time, even though my version failed to compile for iOS4.
However, now I've got the new version (complied for iOS4.2) waiting for review - I'm unsure what will happen to the existing app! If it is used overwritten, what will people with old versions of iOS see? Am I closing the door to anyone without iOS4.2+?
Many thanks
Ben.
p.s. apologies if this has been covered - I did look and failed to find :-)
When you specify the minimum OS required in the bundle, that filters what users will be notified of the upgrade. So users of your app that have yet to upgrade the underlying OS will not get pushed the update.
You can actually specify the target OS Level to an earlier version. The app will be allowed to install on that and any newer version. Generally, Apple is very good about forward-compatibility.
As Peter said, you probably don't want to compile it to only run on 4.2. If you added features that use newer versions of iOS, you can actually do a check prior to calling the method (I've done this with gesture recognizers) to ensure that the running OS version is capable. If you don't validate the OS, the app will simply crash on users with too-old operating systems, which could cause Apple to reject it.
Also, 4.3 is almost out, so you might as well wait a week :)
If your app only supports 4.2+, then only users with a device with 4.2+ iOS will be able to install and use your app. The version currently on the store will be overwritten. In short, yes you are "closing the door" to anyone with a lower version iOS.

way, to enforce upgrade of iphone-app inside app-store?

When releasing multiple versions of an iphone-app, there are problems:
you are running very old apps (still need to support them through server-api)
you have to live with bugs of a certain app, once released blocker-bugs are not fixable
Is there a way to mark an iphone-app as unsupported or enforce an online-update, i.e. when it starts up it will show an upgrade button?
So far I always read that you cannot enforce an upgrade of an iphone-app. Is this correct, can somebody give me official reference/link for that? I just cannot believe that once you released an iphone-app this is for eternity? An "unsupported" marker would be a very helpful app-store feature...
You can not enforce app upgrade, but you can add a mecanism in your app to display a message to say that the version is not compatible with server-api. Of course it should be provide on the first app version...