iAds not showing on device after release to App Store?

ⅰ亾dé卋堺 提交于 2019-12-11 04:26:48

问题


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.

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

Before Release:

After Release:

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

回答1:


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

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.

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



来源:https://stackoverflow.com/questions/37012528/iads-not-showing-on-device-after-release-to-app-store

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!