有什么方法可以在应用程序崩溃之前截取屏幕截图。我正在使用此代码截取屏幕截图,但如何知道应用何时会崩溃?
func screenShotMethod() {
//Create the UIImage
UIGraphicsBeginImageContext(view.frame.size)
view.layer.renderInContext(UIGraphicsGetCurrentContext())
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
//Save it to the camera roll
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
}
最佳答案
AppDelegate:
func applicationWillTerminate(application: UIApplication) {
//that methiod is called when app is going to crash
}
关于iOS - 在应用程序崩溃前截取屏幕截图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33705853/