开发者

Is there a way to 'self-destruct' an application from within itself?

I want the ability to uninstall an application from within itself. Example: UIAlertView pops up and says "This Application has Expired." The user hits 'Ok' and then the application proceeds to shut down and remove itself from th开发者_运维问答e device. Is there any way to do this?


I don't think there is a way to remove the app from phone itself. But, you can terminate the execution of an app from code using,

exit(0);

And this is also not encouraged as you should not quit the app abruptly without the user's knowledge. But its alright if you show an alert and quit the app, and is really necessary to quit the app.


No. And even if was technically possible, Apple would reject it. They don't like apps that are time limited -- note that even "lite" apps have to be useful in their own right.


I agree that you can terminate the app but I would also say that you should consider that the HIG says the following:

Don’t Quit Programmatically


Never quit an iOS application programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your application from functioning as intended, you need to tell your users about the situation and explain what they can do about it. Depending on how severe the application malfunction is, you have two choices.

Display an attractive screen that describes the problem and suggests a correction. A screen provides feedback that reassures users that there’s nothing wrong with your application. It puts users in control, letting them decide whether they want to take corrective action and continue using your application or press the Home button and open a different application

If only some of your application's features are not working, display either a screen or an alert when people activate the feature. Display the alert only when people try to access the feature that isn’t functioning.

If you want to programatically quit the application, you MUST have something in place to inform the user what is going on and possibly offer a way for the user to recover (subscribe to a service or something) so that the user can continue to enjoy the app that they presumably love.


As Stephen said, no, it's not possible.

The traditional means is to provide LITE and FULL versions of the application. The LITE version is functional and allows a user to see some of the functionality of your application while also offering the ability to upgrade to the full version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜