Detect iOS Application About to Delete

Detect iOS application about to delete?

No such thing, sorry.

The best you can do is do is check for the UIApplicationWillTerminateNotification notification but more importantly save the state of your app (on a server for example) when it's transitioning to the background and cross your fingers your user will not delete your app when it's not running. Because once your app closed, you don't have any control anymore.

EDIT: Since you want to clear the keychain's content when the app is deleted, I suggest you take a look at this other question. Basically, what is suggested by some answers there is not to remove the content of the keychain at delete time, but instead when the user first launches the app using NSUserDefaults.

EDIT: Luis Ascorbe commented with an idea: using Push Notification's feedback service ( https://stackoverflow.com/a/7912045/157401 ) Of course, that's far from perfect (not all users subscribe to the notifications, notification tokens might be invalidated for other reasons, etc.) but that's still something to consider.

EDIT: Starting with iOS 10.3 Beta 2, keychain data appears to no longer be persisted when an app is deleted.

When App deletes (uninstall) getting a mail iOS

Basically, As you know there is no event is fired when App is deleted from the iPhone.

But you can do your tasks when the app installs so basically you can check application by sending the silent push notification.

Apple server will inform you when you try to push to an uninstalled instance the notification response at the sender side will come 410 means, user, no longer activate.

APNS REQUEST/RESPONSE

If you do not get the proper response from application side that means your application is uninstalled and you can send the mail.

Helpful links:

Call status change web-service when my App is deleted

iOS - How to detect uninstallation

To answer your question in one word: No. It's not possible on iOS to detect the uninstallation of your app.

EDIT: As a workaround you could save the date of the last app launch on the server and when it's e.g. more than >30 days in the past you mark the app as "probably uninstalled".

Is there a method that gets called on app uninstallation?

No, its not possible.
But you can check if the application has re-installed by storing a key in iCloud using keychain.

Detect if (current) app is deleted in iOS?

There is no defined notification when an application is deleted. If you must talk to a server, suspend inactive accounts after a predefined time limit.

How to detect user uninstalled iOS App? I need push serious notification. I don't wanna lose it

APNS has a feedback service where Apple reports any device token that is no longer active on the users device. You are required by Apple to check the tokens from the feedback service and stop sending pushes to those devices.

You can use this same information to automatically move the user back to SMS. Just tie the device token to the phone number in your database. If the token is active, send pushes to it. If it is reported by the feedback service to be in-active, remove it from your records and use the users phone number for SMS again.

Just remember that a device token can become active again, at which point, it will be registered with you through the same mechanism it was the first time. Re-save it with the user and use push again.

Function that detects an app uninstall/reinstall

Presumably you're using Keychain because you need to store sensitive information? If so then you could just store a boolean in UserDefaults and check if that exists. For example:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let freshInstall = !UserDefaults.standard.bool(forKey: "alreadyInstalled")
if freshInstall {
// delete your item from keychain
UserDefaults.standard.set(true, forKey: "alreadyInstalled")
}

return true
}

This way you still have the security of the Keychain, but the behaviour of UserDefaults on uninstall/reinstall.

iOS how to detect when app was removed from process

You can't detect this. From the iOS App Programming Guide ("App Termination" heading):

Important: The applicationWillTerminate: method is not called if your app is currently suspended.

Even if you develop your app using iOS SDK 4 and later, you must still
be prepared for your app to be killed without any notification. The
user can kill apps explicitly using the multitasking UI. In addition,
if memory becomes constrained, the system might remove apps from
memory to make more room. Suspended apps are not notified of
termination but if your app is currently running in the background
state (and not suspended), the system calls the
applicationWillTerminate: method of your app delegate. Your app cannot
request additional background execution time from this method.



Related Topics



Leave a reply



Submit