I am developing an application and i need to know whether user installed the app for the first time or upgraded it from the App Store.
How can i detect whether app is installed for the first time or upgraded or re-installed?
Thanks for your answers in advance.
Open the App Store. Tap your profile icon at the top of the screen. Scroll to see pending updates and release notes. Tap Update next to an app to update only that app, or tap Update All.
In the older software, there is no way of finding out exactly when an app was purchased, but in the latest software, you can go to the App Store and select Updates, then click on the top right to go to Purchased and see if the app was purchased (paid or free) and the date of install.
You can place multiple copies of the same app on your home screen with iOS 15. Here's a funny one: iOS 15 lets you place multiple copies of the same app on Springboard. This means you can have the same app duplicated across your home screens, as many times as you want.
You can differentiate between the first start after installing the App, the first start after an update and other starts quite easily via saving the latest known version to standardUserDefaults
. But as far as I know it is not possible do detect a re-install of the App as all App-related data are also removed when the App is deleted from the device.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSString* currentVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; NSString* versionOfLastRun = [[NSUserDefaults standardUserDefaults] objectForKey:@"VersionOfLastRun"]; if (versionOfLastRun == nil) { // First start after installing the app } else if (![versionOfLastRun isEqual:currentVersion]) { // App was updated since last run } else { // nothing changed } [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:@"VersionOfLastRun"]; [[NSUserDefaults standardUserDefaults] synchronize]; }
Checkout Swift 3.0 version of code.
Note: Use CFBundleShortVersionString, for checking actual App version checking.
func checkAppUpgrade() { let currentVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String let versionOfLastRun = UserDefaults.standard.object(forKey: "VersionOfLastRun") as? String if versionOfLastRun == nil { // First start after installing the app } else if versionOfLastRun != currentVersion { // App was updated since last run } else { // nothing changed } UserDefaults.standard.set(currentVersion, forKey: "VersionOfLastRun") UserDefaults.standard.synchronize() }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With