有没有办法在应用程序崩溃之前截取屏幕截图。我使用此代码截取屏幕截图,但如何知道应用程序何时崩溃?
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)
}
答案 0 :(得分:1)
<强>的AppDelegate:强>
func applicationWillTerminate(application: UIApplication) {
//that methiod is called when app is going to crash
}