// MARK: 1.10、退出app(类似点击home键盘)退到后台 /// 退出app(类似点击home键盘) public static func exitApp() { DispatchQueue.main.async { UIApplication.shared.perform(#selector(NSXPCConnection.suspend)) } }
2.类似闪退
guard let window = UIApplication.shared.keyWindow else { return } UIView.animate(withDuration: 0.5, animations: { window.alpha = 0 window.frame = CGRect(x: 0, y: window.bounds.size.height / 2, width: window.bounds.size.width, height: 0.5) }) { _ in exit(0) }
- (void)exitApplication { UIWindow *window = [UIApplication sharedApplication].keyWindow; [UIView animateWithDuration:0.5f animations:^{ window.alpha = 0; window.frame = CGRectMake(0, window.bounds.size.height / 2, window.bounds.size.width, 0.5); } completion:^(BOOL finished) { exit(0); }]; }
3.
/// APP主动崩溃 static func exitApp() { // 默认的程序结束函数 abort() }
 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号