Is there any way to programmatically delete my own iOS app? - ios

Is there any way within the iOS SDK for an app to delete itself?
I'm seeking the following behavior:
If a user fails to enter the correct password to log in (5 times)
The app deletes all user data AND deletes itself from the iPhone.
I understand how to delete all user data. I'm just asking if it's possible to delete the app as well.

No, only the user (or iTunes, or Xcode's Organizer) can remove applications from the device.

Not at all. All your app can do is delete its user data and refuse to do anything else. Removing it from the system is entirely up to the user.

No, it's not possible. I don't know about jailbroken devices though.

Related

Programmatically erase iPhone's data swift

I am developing an iPhone Application to wipe all data from iPhone including photos, videos, contacts, messages, apps, etc. programmatically. I wish to achieve this with an iPhone Application only.
The approach I am thinking of somehow I manage to Clear data from iPhone and rewrite the memory with some junk files or binary data 1010 say. (Its just an idea!)
All I have managed to do is delete photos from Photos which are further not deleted from Recently deleted folder in Photos App.
Also, I found this Programmatically How to wipe out iPhone or iPad data in i phone apps in i phone apps which declines it's feasibilty.
But, Is there a way to programatically restore my iphone to factory settings? says using the C files mentioned here https://github.com/lite/osxrce/blob/master/resetapp/main.m can may be make it possible. They say they tried it on a jailbroken device though.
What you are hoping to do isn't possible on an non-jailbroken iPhone. You will be violating the iOS sandboxing among other things.
A similar outcome may be possible by creating your own MDM server, and building your app to interface with it. On first installation of your app, you can have it install the MDM profile. The app can then feature your 'Wipe' button which can signal to the MDM to send a wipe push notification to the device.
It would take a lot more work that what you're asking about, but it should be possible.
Reference: https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf
Apple do not allow to delete files which aren't created or part of your application, so you will not be able to delete data of other apps.
I don't think you're allowed to do that anyway. Even if you were able to do it, it would not be accepted on the app store.
You can backup the iPhone via AppleMobileBackup.exe -b, then modify the according
database file(such as addresscontacts, messages), and restore the modified ituensbackup files to the iPhone via AppleMobileBackup.exe -r.

Delete Existing iPhone App

I have an iPhone app that now needs to be removed. I can do this by following the steps in iTunes connect:
Untick all territories in pricing and availability
Then in Additional Information : Delete App
I have completed step 1 and am about to follow step 2 but I have a question that I cannot find answered on any of their help/docs nor online elsewhere. Once I delete the app - it will get removed from the app store, but will it still stay on all users iPhones that have already got the app downloaded and installed on their phone? Or will it automatically be deleted/removed from all phones?
Ideally I need to remove the app completely so that it can no longer be used be new or existing users even if they already have it on their phone.
It will stay on the user's phones.
In your case even worse for you: If they backed up/synchronized the application LOCALLY via iTunes, they got a local .ipa-file (an instance of your app), which they could even restore, after they setup the device once again.
For the users this is a pretty convenient way. So, if you want to delete your application. Inform users about that step and if you have a good exit strategy, users will adopt this and will delete it on their own.
The app will stay on the users IPhones. There is no way to remove it remotely.
The only thing you could do would be to release new version with a lock but then you will probably get trouble with Apple.

Delete iOS app settings [duplicate]

This question already has an answer here:
Is it possible to reset the privacy settings in iOS?
(1 answer)
Closed 7 years ago.
I'm working on an app that requires requesting mail access. Since the simulator doesn't have a Mail app I've been using my physical device to test the app.
My problem is that I want to test the request to access Mail in relation to the welcome/intro screen that I've made but even if I delete the Xcode build version of the app from my device the settings for allowing the Mail access still persist.
I want to force those settings to delete when I delete my app from the device so that it requests Mail access after every fresh install for the sake of testing. So far the only solution that I've seen for doing this is to complete a fresh install of iOS each time, but that's much to much trouble when I'd be wanting to do it several times.
Does anybody have a solution for this?
The simulator does actually have a Calendar and I do plenty of testing on it. If you want to add more calendars via the simulator, open the calendar app, tap edit at the top and you can enter new calendars.
Here's the solution I found thanks to #Martin R's comment.
Go to General > Reset > Reset Location & Privacy
This reset accomplished what I needed for the problem.
I've myself run into the same problem when allowing photo access.
It's not a proper answer, but the workaround I found was effective: just change the bundle id when you want to test this behaviour. iOS will assume it's a different app and ask you again for all the authorisations granted before.
I'm still interested by the proper answer though — if there ever is one.

How to make an iphone application that should not give user permission to delete itself. Is there any way to do so?

I am in an organization which is going to provide ipad installed with our app. On particular ipads to sales staff we want that app should not be deletable from that ipad. Is there any way to do so by programatically in xcode? That app is not going to be on App Store. Please help if anyone has any answers?
You can't do it from within the code of the app. You can do it only by implementing some MDM solution.
You can't do this from Xcode. But there is another tip: you can activate the restrictions. Go under Settings -> General -> Restrictions and disable "Deleting Apps". From now, your app won't be deleted.

How do I programmatically remove an application from an iOS device? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Programmatically delete my own app
Currently I am working on a iphone application and one of the critical requirement of the application is if a user cannot successfully authenticate after 5 attempts, the application is removed from the user’s iPhone.
How can I achieve this goal?
Being able to alter things outside of the application's own sandbox is a huge security risk that Apple (understandably) has not allowed. Therefore you will not be able to do this. The best you can do is store the result in a persistent value and not allow to app to continue after launching. For bonus points, you can store this value in the iOS keychain so that it will persist between installs if you like, then the user will be forced to reset their ios device to factory defaults to be able to use it again.
Can't be done. The best you can do is to make your app stop functioning after five failed authentication attempts.
you cant. the only one who can have this privilige is the user. You could just make the app to not open anymore, making the user angry and then deleting it afterwards.
Its not possible. You should handle it programmatically like locking the application. Once user is failed for 5 attempts, change your startup viewcontroller and do not allow the user to navigate any where else. Here you can display some message to delete the app.
An application, installed in a non-jailbroken device, is a sandboxed eco-system.
If your app is for App Store, this thing cannot be done. If this app is for a JB device (for In-House apps would be possible, but I think you need root permissions to delete apps), try to remove the app file from disk after the app has gone on background (but I'm quite sure files are locked, so you'll not be able to do it). If this approach, as I guess, doesn't work due to locked files, you can try to search for private APIs.
It's not possible. You only solution is lock the app if authentication not success.

Resources