Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios iPad上共享按钮的应用程序崩溃_Ios_Iphone_Ipad - Fatal编程技术网

Ios iPad上共享按钮的应用程序崩溃

Ios iPad上共享按钮的应用程序崩溃,ios,iphone,ipad,Ios,Iphone,Ipad,我已经创建了一个应用程序,你可以在其中分享你的分数。它在iPhone上运行得很好,但在iPad上它会使应用程序崩溃。我一直在AppDelegate中得到一个“线程1:信号SIGABRT” class GameViewController: UIViewController, GameSceneDelegate { override func viewDidLoad() { super.viewDidLoad() if let skView = self.

我已经创建了一个应用程序,你可以在其中分享你的分数。它在iPhone上运行得很好,但在iPad上它会使应用程序崩溃。我一直在AppDelegate中得到一个“线程1:信号SIGABRT”

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)
    }
}

请将此代码与现有func共享字符串一起附加

if youractivityView.respondsToSelector("popoverPresentationController") {
        youractivityView.popoverPresentationController.sourceView = parentView
    }

可能的副本,如果需要更多的帮助,然后让我知道