2012-10-14

ios app 判定用戶不能使用直接跳出的好方法


After some tests, I can say the following:
  • using the private interface : [UIApplication sharedApplication] will cause the app looking like it crashed, BUT it will call - (void)applicationWillTerminate:(UIApplication *)application before doing so;
  • using exit(0); will also terminate the application, but it will look "normal" (the springboard's icons appears like expected, with the zoom out effect), BUT it won't call the - (void)applicationWillTerminate:(UIApplication *)application delegate method.
My advice:
  1. Manually call the - (void)applicationWillTerminate:(UIApplication *)application on the delegate.
  2. Call exit(0);.
推薦使用=> exit(0);

要讓用戶死的明白~ 
可以用~ =>  UIAlertView警告他之後再...  自爆~

reference : Stack Overflow

沒有留言: