首页 > 移动平台 > 详细

APP强制退出

时间:2016-02-19 12:02:12      阅读:309      评论:0      收藏:0      [点我收藏+]

第一种方法:

企业版可以用,Appstore可能被拒,慎用

 

 1 - (void)exitApplication {
 2     
 3     AppDelegate *app = [UIApplication sharedApplication].delegate;
 4     UIWindow *window = app.window;
 5     window.backgroundColor = [UIColor redColor];
 6 
 7     
 8     [UIView animateWithDuration:1.0f animations:^{
 9         window.alpha = 0;
10         window.frame = CGRectMake(0, window.bounds.size.width, 0, 0);
11     } completion:^(BOOL finished) {
12         exit(0);
13     }];
14     
15 }

 

第二种方法 - 推荐,官方例子经常出现

 

1       [self performSelector:@selector(sayByeBye)];
2      
3 
4 -(void)sayByeBye{
5     abort();
6 }

 

APP强制退出

原文:http://www.cnblogs.com/-yun/p/5200135.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!