search

Home  >  Q&A  >  body text

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

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

巴扎黑巴扎黑2889 days ago449

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-17 17:57:03

    Normally I won’t refuse, I did see someone doing this.
    Just one line is enough, and this is not a crash, there will be no crash log:

    exit(0);

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:57:03

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

    If it is an app published on the App Store, it is recommended not to do this. The document clearly states that if it is discovered by the reviewer, it will basically be rejected:

    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.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 17:57:03

    It may be rejected. After all, the exit function is not recommended. It depends on your mood. If your application is not easy to test, it may not be rejected.

    reply
    0
  • Cancelreply