APP强制退出

第一种方法:

企业版可以用,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强制退出)