Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.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
Xcode Can';我看不到iAds的横幅_Xcode_Swift_Iad - Fatal编程技术网

Xcode Can';我看不到iAds的横幅

Xcode Can';我看不到iAds的横幅,xcode,swift,iad,Xcode,Swift,Iad,其他人是否有问题?如果他们看不到iAds的横幅,但当你第一次运行应用程序时,会出现一个蓝色的大屏幕,上面显示你现在已连接到iAds。我正在iPhone上运行我的应用程序,我的iAD开发者应用程序测试填充率设置为100% 代码: import UIKit import StoreKit import SpriteKit import GameKit import iAd extension SKNode { class func unarc

其他人是否有问题?如果他们看不到iAds的横幅,但当你第一次运行应用程序时,会出现一个蓝色的大屏幕,上面显示你现在已连接到iAds。我正在iPhone上运行我的应用程序,我的iAD开发者应用程序测试填充率设置为100%

代码:

   import UIKit
    import StoreKit
    import SpriteKit
     import GameKit
      import iAd


     extension SKNode {
class func unarchiveFromFile(file : String) -> SKNode? {
    if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") {
        var sceneData = NSData(contentsOfFile: path, options:   .DataReadingMappedIfSafe, error: nil)!
        var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)

        archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
        let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as! GameScene
        archiver.finishDecoding()
        return scene
    } else {
        return nil
    }
}

  }

  class GameViewController: UIViewController, ADInterstitialAdDelegate      {
var interstitialAd:ADInterstitialAd!
var interstitialAdView: UIView = UIView()


override func viewDidLoad() {
    super.viewDidLoad()

    loadInterstitialAd()
    ADBannerView()


    func gameCenterViewControllerDidFinish(gameCenterViewController: GKGameCenterViewController!)
    {
        gameCenterViewController.dismissViewControllerAnimated(true, completion: nil)
    }




    var localPlayer = GKLocalPlayer()

    localPlayer.authenticateHandler = {(viewController, error) -> Void in

        if (viewController != nil) {
            let vc: UIViewController = self.view!.window!.rootViewController!
            vc.presentViewController(viewController, animated: true, completion: nil)
        }

        else {
            println((GKLocalPlayer.localPlayer().authenticated))

        }
    }








    if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
        // Configure the view.
        let skView = self.view as! SKView
        skView.showsFPS = false
        skView.showsNodeCount = false

        /* Sprite Kit applies additional optimizations to improve rendering performance */
        skView.ignoresSiblingOrder = true

        /* Set the scale mode to scale to fit the window */
        scene.scaleMode = .AspectFill

        skView.presentScene(scene)
    }



}



override func shouldAutorotate() -> Bool {
    return true
}

override func supportedInterfaceOrientations() -> Int {
    if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
        return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue)
    } else {
        return Int(UIInterfaceOrientationMask.All.rawValue)
    }
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Release any cached data, images, etc that aren't in use.
}

override func prefersStatusBarHidden() -> Bool {
    return true
}


  func loadInterstitialAd() {
interstitialAd = ADInterstitialAd()
interstitialAd.delegate = self
  }

  func interstitialAdWillLoad(interstitialAd: ADInterstitialAd!) {

  }

  func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
interstitialAdView = UIView()
interstitialAdView.frame = self.view.bounds
view.addSubview(interstitialAdView)

interstitialAd.presentInView(interstitialAdView)
UIViewController.prepareInterstitialAds()
 }

func interstitialAdActionDidFinish(interstitialAd: ADInterstitialAd!) {
interstitialAdView.removeFromSuperview()
 }

  func interstitialAdActionShouldBegin(interstitialAd: ADInterstitialAd!, willLeaveApplication willLeave: Bool) -> Bool {
return true
  }

  func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {

  }

  func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
interstitialAdView.removeFromSuperview()
   }

   }

那个蓝色的大屏幕是你的插播广告。你想要插播广告吗?检查我的答案,以获得一些关于如何实施它们的指导。