且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

接收有关卸载iPhone应用程序的事件

更新时间:2023-11-04 16:01:04

不,当他们选择卸载应用程序时,您没有机会执行任何代码.

No, you do not get the opportunity to execute any code when they choose to uninstall your app.

如果您认为他们希望删除的数据添加到通讯簿,则可能应该在应用程序的设置页面上为他们提供一种删除数据的方法.可能会警告用户仅在您打算卸载应用程序时删除此数据"或类似的内容.

If there is data you add to the address book that you think they may wish to remove, then you should probably provide a way for them to do so, perhaps on a settings page inside your app. The user could be warned to "only remove this data if you intend to uninstall the app" or something like that.

更好的是,由于用户以后总是可以在其地址簿中随意更改数据,并且有可能破坏您的应用程序,因此更好的做法是将所有与应用程序相关的数据存储在为您的应用程序自动创建的documents目录,例如plist或sqlite格式.

Better still, since the user could always arbitrarily change data in their address book at a future time, and perhaps break your application, a much better practice would be to store any app-related data in the documents directory created automatically for your app, in a plist or sqlite format for example.