Proper way to exit iPhone application?

前端 未结 25 2724
难免孤独
难免孤独 2020-11-22 01:54

I am programming an iPhone app, and I need to force it to exit due to certain user actions. After cleaning up memory the app allocated, what\'s the appropriate method to ca

25条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 02:33

    Exit an app other way than the home button is really non-iOS-esque approach.

    I did this helper, though, that use no private stuff:

    void crash()
    { [[NSMutableArray new] addObject:NSStringFromClass(nil)]; }
    

    But still not meant for production in my case. It is for testing crash reportings, or to fast restart after a Core Data reset. Just made it safe not to be rejected if function left in the production code.

提交回复
热议问题