Cómo tomar capturas de pantalla mediante programación (Swift, SpriteKit)
Intenté lo que se sugirió, pero el resultado fue una captura de pantalla blanca y en blanco. Lo que me lleva a suponer que no he agregado nada a la vista. Así es como agrego gráficos a mi vista. El método addChild viene con SpriteKit y requiere SKSpriteNodes:
addChild(background)
addChild(rate)
addChild(scoreLabel)
addChild(share)
addChild(playAgain)
addChild(highScoreLabel)
addChild(scoreBackground)
addChild(highScoreBackground)
Aquí está el método que toma la captura de pantalla:
UIGraphicsBeginImageContext(self.view!.bounds.size)
self.view!.layer.renderInContext(UIGraphicsGetCurrentContext())
let screenshot = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
UIImageWriteToSavedPhotosAlbum(screenshot, nil, nil, nil)
Cualquier sugerencia sería útil