iOS 开发,如何在程序内点击按钮杀死APP

特殊需求,需要在APP内点击一个按钮,杀死APP。求实现方法,并且请问,这种功能,会被会有被Apple store拒绝的危险

阅读 7.6k
3 个回答

一般不会拒绝,我确实看到有这么干的。
只要一行就行,并且,这不是crash,不会有crash log:

exit(0);

参见: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/StartingStopping.html

如果是发布到 App Store 上的 app ,建议不要这么做,文档上清楚地写明了,如果被审核人员发现的话,基本就是被拒了:

Always Be Prepared to Stop

An iOS app never displays a Close or Quit option. People stop using an app when they switch to another app, return to the Home screen, or put their devices in sleep mode.

Never quit an iOS app programmatically. People tend to interpret this as a crash. If something prevents your app from functioning as intended, you need to tell users about the situation and explain what they can do about it.

可能会被拒绝的,毕竟exit函数是不推荐使用的,这得看心情了。如果你的这个应用不那么好测试的话,那有可能不被拒绝。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题