发布到App Store后,iAds没有显示在设备上吗? [英] iAds not showing on device after release to App Store?

查看:41
本文介绍了发布到App Store后,iAds没有显示在设备上吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将自己的游戏发布到了App Store. iAd横幅广告和中型广告现在将近一周没有显示.所有显示的都是空白,如以下屏幕截图所示.

I have recently released my game to the App Store. The iAd banner and medium ads are not showing up after almost a week now. All its showing isa blank space as in the following screenshots.

任何人都可以检查我的iAd代码是否有问题吗?

Can anyone check if there is anything wrong with my iAd code?

发行前:

发布后:

import UIKit
import SpriteKit
import iAd
import Social
import GameKit
import StoreKit

class GameViewController: UIViewController, ADBannerViewDelegate, GKGameCenterControllerDelegate, ADInterstitialAdDelegate {
var scene: GameScene!

@IBOutlet var bannerView: ADBannerView!
var imageView = UIImageView()
var interAd = ADInterstitialAd()
var mediumRectAdView = ADBannerView(adType: ADAdType.MediumRectangle)
var interAdView = UIView()
var closeButton = UIButton(type: UIButtonType.System)

override func viewDidLoad() {

    super.viewDidLoad()

    let screenBounds: CGRect = UIScreen.mainScreen().bounds
    bannerView = ADBannerView(frame:CGRectMake(0,0,50,screenBounds.width))
    bannerView.center = CGPoint(x: screenBounds.width/2, y:screenBounds.height-bannerView.frame.size.height/2)
    bannerView.delegate = self
    bannerView.hidden = false//false //<<<<<<<<<<<<<<<<<<<<<<,

    scene = GameScene(size:CGSize(width: 2048, height: 1536))
    let skView = self.view as! SKView
    scene.scaleMode = .AspectFill
    skView.presentScene(scene)
    skView.addSubview(bannerView)
    if scene.productPurchased == true {
        bannerView.hidden = true
    }    
    firstScene = false

    //self.interstitialPresentationPolicy = ADInterstitialPresentationPolicy.Manual

    //Authenticate Game Center
    NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(GameViewController.showAuthenticationViewController),name:PresentAuthenticationViewController, object: nil)
    SGGameKit.sharedInstance.authenticateLocalPlayer()

    // Share
    NSNotificationCenter.defaultCenter().addObserver(self, selector: (#selector(GameViewController.displayShareSheet)), name:mySharePostKey, object: nil)

    // Med iAD
    NSNotificationCenter.defaultCenter().addObserver(self, selector: (#selector(GameViewController.loadMedAd)), name:myloadMedAdKey, object: nil)

    // Interstitial iAD
    NSNotificationCenter.defaultCenter().addObserver(self, selector: (#selector(GameViewController.loadInterAd)), name:myloadInterAdKey, object: nil)

    // Hide Iad
    NSNotificationCenter.defaultCenter().addObserver(self, selector: (#selector(GameViewController.hideAd)), name:myHideAdKey, object: nil)
}

func hideAd() {
    print("Hiding Ad")
    bannerView.hidden = true
}

func displayShareSheet() {

    let initialText = "OMG! I got \(scene.score) points in Jumpox\n" + "https://itunes.apple.com/us/app/id1099659993)"
    if let myImage =  self.view?.pb_takeSnapshot() {
        UIImageWriteToSavedPhotosAlbum(myImage, nil, nil, nil)
        let activityViewController = UIActivityViewController(activityItems: [initialText,myImage as UIImage], applicationActivities: [])
        activityViewController.excludedActivityTypes = [UIActivityTypeOpenInIBooks]

        if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Phone {
            self.presentViewController(activityViewController, animated: true, completion: {})
        }
        else {
            let popup: UIPopoverController = UIPopoverController(contentViewController:activityViewController)
            popup.presentPopoverFromRect(CGRectMake(self.view.frame.size.width / 2, self.view.frame.size.height / 4, 0, 0), inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
        }
    }
}

func loadMedAd() {

    print("Loading loadMedAd")
    closeButton = UIButton(type: UIButtonType.System)
    closeButton.frame = CGRectMake(5, 5, 30, 30)
    closeButton.layer.cornerRadius = 10
    closeButton.setTitle("X", forState: .Normal)
    closeButton.setTitleColor(UIColor.blackColor(), forState: .Normal)
    closeButton.backgroundColor = UIColor.whiteColor()
    closeButton.layer.borderColor = UIColor.blackColor().CGColor
    closeButton.layer.borderWidth = 1
    closeButton.addTarget(self, action: #selector(GameViewController.close), forControlEvents: UIControlEvents.TouchDown)

    mediumRectAdView!.delegate = self
    mediumRectAdView.center = self.view.center
    mediumRectAdView.addSubview(closeButton)

    interAdView = UIView(frame: self.view.frame)
    self.view.addSubview(interAdView)

    interAdView.addSubview(mediumRectAdView)
}

func loadInterAd() {

    print("Loading loadInterAd")

    interAd = ADInterstitialAd()
    interAd.delegate = self

    //if interAd.loaded {
        closeButton.frame = CGRectMake(10, 10, 40, 40)
        closeButton.layer.cornerRadius = 10
        closeButton.setTitle("X", forState: .Normal)
        closeButton.setTitleColor(UIColor.blackColor(), forState: .Normal)
        closeButton.backgroundColor = UIColor.whiteColor()
        closeButton.layer.borderColor = UIColor.blackColor().CGColor
        closeButton.layer.borderWidth = 1
        closeButton.addTarget(self, action: #selector(GameViewController.close), forControlEvents: UIControlEvents.TouchDown)

        interAdView = UIView(frame: self.view.frame)
        interAdView.frame = self.view.bounds
        self.view.addSubview(interAdView)

        interAd.presentInView(interAdView)
        interAdView.addSubview(closeButton)
    //}

    //requestInterstitialAdPresentation()
}

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

    print("Failed To Receive")
    closeButton.removeFromSuperview()
    interAdView.removeFromSuperview()
}

func close() {

    closeButton.removeFromSuperview()
    interAdView.removeFromSuperview()
}

func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}

func showAuthenticationViewController() {

    let gameKitHelper = SGGameKit.sharedInstance
    if let authenticationViewController = gameKitHelper.authenticationViewController {
        self.presentViewController(authenticationViewController, animated: true,
                                   completion: nil)
    }
}

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

deinit {
    NSNotificationCenter.defaultCenter().removeObserver(self)
}
}

推荐答案

iAd已停产,并且不接受网络中的新应用.

iAd has been discontinued and is not accepting new apps into the network.

iAd App网络将从2016年6月30日起终止.尽管 我们不再接受新应用加入网络,广告 广告系列可能会继续投放,您仍然可以赚取广告 收入直到6月30日.如果您想继续推广您的应用 在此之前,您可以通过iAd进行广告投放.

The iAd App Network will be discontinued as of June 30, 2016. Although we are no longer accepting new apps into the network, advertising campaigns may continue to run and you can still earn advertising revenue until June 30. If you’d like to continue promoting your apps through iAd until then, you can create a campaign using iAd Workbench.

令我惊讶的是,审稿人没有拒绝您的提交.查看AdMob,AppLovin或可用于iOS的许多其他广告网络.

I'm surprised the reviewer did not reject your submission. Look into AdMob, AppLovin, or the many other ad networks available for iOS.

这篇关于发布到App Store后,iAds没有显示在设备上吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆