xcode 如何以编程方式从 iOS 设备中删除应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9906174/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I programmatically remove an application from an iOS device?
提问by Apekshit
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.
目前我正在开发一个 iphone 应用程序,该应用程序的关键要求之一是,如果用户在 5 次尝试后无法成功通过身份验证,则该应用程序将从用户的 iPhone 中删除。
How can I achieve this goal?
我怎样才能实现这个目标?
回答by borrrden
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.
能够在应用程序自己的沙箱之外更改内容是 Apple(可以理解)不允许的巨大安全风险。因此,您将无法执行此操作。您能做的最好的事情是将结果存储在一个持久值中,并且不允许应用程序在启动后继续运行。对于奖励积分,您可以将此值存储在 iOS 钥匙串中,以便它在安装之间保留(如果您愿意),然后用户将被迫将其 ios 设备重置为出厂默认设置才能再次使用它。
回答by yuji
Can't be done. The best you can do is to make your app stop functioning after five failed authentication attempts.
做不到。您能做的最好的事情是让您的应用在五次身份验证尝试失败后停止运行。
回答by newton_guima
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.
你不能。唯一可以拥有此特权的是用户。你可以让应用程序不再打开,让用户生气,然后删除它。
回答by Apurv
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.
这是不可能的。您应该像锁定应用程序一样以编程方式处理它。一旦用户尝试失败 5 次,请更改您的启动视图控制器,并不允许用户导航任何其他地方。您可以在此处显示一些消息以删除应用程序。
回答by bontoJR
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.
安装在非越狱设备中的应用程序是一个沙盒生态系统。如果你的应用是面向 App Store 的,这件事是做不到的。如果此应用程序用于 JB 设备(对于内部应用程序是可能的,但我认为您需要 root 权限才能删除应用程序),请尝试在应用程序进入后台后从磁盘中删除该应用程序文件(但我很确定文件已被锁定,因此您将无法执行此操作)。如果我猜这种方法由于文件锁定而不起作用,您可以尝试搜索私有 API。
回答by Hasintha Janka
It's not possible. You only solution is lock the app if authentication not success.
这是不可能的。如果身份验证不成功,您唯一的解决方案是锁定应用程序。