I've created an app where you can share your score. It works great on the iPhones, but on the iPads it crashes the app. I keep getting a "Thread 1: signal SIGABRT" in the AppDelegate.
class GameViewController: UIViewController, GameSceneDelegate {
override func viewDidLoad() {
super.viewDidLoad()
if let skView = self.view as? SKView {
if skView.scene == nil{
// create the scene
let scene = GameScene(size: CGSize(width: 2048, height: 1536), delegate: self, gameState: .MainMenu)
skView.showsFPS = false
skView.showsNodeCount = false
skView.ignoresSiblingOrder = true
scene.scaleMode = .AspectFill
skView.presentScene(scene)
}
}
self.canDisplayBannerAds = true
}
override func prefersStatusBarHidden() -> Bool {
return true
}
func screenshot() -> UIImage {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, 1.0)
view.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
func shareString(string: String, url: NSURL, image: UIImage) {
let vc = UIActivityViewController(activityItems: [string, url, image], applicationActivities: nil)
presentViewController(vc, animated: true, completion: nil)
}
}