Is there any way to programmatically delete my own iOS app?
No, only the user (or iTunes, or Xcode's Organizer) can remove applications from the device.
How do I programmatically remove an application from an iOS device?
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.
How to remove app from background programmatically in ios
A solution is to send a silent notification and upon getting the notification calling exit(0)
in you code but I will recommend against this as it will not pass Apple review.
Programmatically erase iPhone's data swift
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
Load and delete an app programmatically
That is not possible on a non-jailbroken device, and for good reason. Depending on what you are selling though, you might want to consider the in-app purchase system Apple provides.
Related Topics
How to Launch IPA File in iOS 10 Real Device Using Appium 1.6.0
Stop Overscroll When Using "-Webkit-Overflow-Scrolling: Touch"
Cancel All Operations + Afnetworking 3.0
Swift Package Manager Issues with Unversioned Packages (Example: Firebase-Ios-Sdk)
Swift + Firebase Security Not Working
Atos Does Not Symbolicate System Frameworks/Libraries Properly
How to Select Table View Row Selection with Custom Checkbox Button
How to Programmatically Open Apple Watch Companion App from iOS App
Initialization of 'Unsafepointer<Int>' Results in a Dangling Pointer
View Height Problems (Continued)
Swift - Add Same Navigation Bar Items to Every Page
How to Set Style of the Statusbar Embedded in a Navigation Controller on iOS13