Iad Is Shutting Down. Should I Remove the Iad Framework from All My Applications

iAd is shutting down. Should I remove the iAd framework from all my applications?

The iAd framework will be deprecated. You don't have to remove your iAd implementations just yet, but you will have to eventually.

Apple has given alot of information on what is going to happen: About the iAd App Network Shutdown

Apps that are not updated will experience the following adverse
conditions:

  • No ads will be returned in your app.
  • A deprecation warning will appear in Xcode.
  • If your app implements ADBannerView and the ADBannerViewDelegate, the bannerView:didFailToReceiveAdWithError: delegate method, it will
    be called with the ADError enum.
  • If your app implements ADInterstitialAd and the ADInterstitialAdDelegate, the interstitialAd:didFailWithError:
    delegate method will be called with an ADError enum.
  • If your app implements the iAdAdditions category on UIViewController, setting the ADInterstitialPresentationPolicy will
    have no effect and calling requestInterstitialAdPresentation: or
    canDisplayBannerAds: will always return NO.
  • If your app implements the iAdPreroll category on AVPlayerViewController or the iAdPreroll category on
    MPMoviePlayerController, calling playPrerollAdWithCompletionHandler:
    will return an ADError enum.
  • When your ADBannerView delegate receives this error, your app should look for other ads (from other ad-networks).
  • Apps that implement the iAdAdditions category on UIViewController and use automatic presentation, should not notice any impact. Apps
    that manually manage the ADBannerView may see a blank space.
  • If you have implemented a mediation layer, contact the mediation provider to understand impact to your app.
  • ADClient APIs (requestAttributionDetailsWithBlock and addClientToSegments) will continue to work.

Apple also suggests removing the iAd framework on your applications next regularly scheduled update. So, submitting an update just to remove the iAd framework isn't necessary: iAd for Developers

On your next regular app update or submission, you should remove the
deprecated iAd framework and connection.

iAd is shutting down. Should I remove the iAd framework from all my applications?

The iAd framework will be deprecated. You don't have to remove your iAd implementations just yet, but you will have to eventually.

Apple has given alot of information on what is going to happen: About the iAd App Network Shutdown

Apps that are not updated will experience the following adverse
conditions:

  • No ads will be returned in your app.
  • A deprecation warning will appear in Xcode.
  • If your app implements ADBannerView and the ADBannerViewDelegate, the bannerView:didFailToReceiveAdWithError: delegate method, it will
    be called with the ADError enum.
  • If your app implements ADInterstitialAd and the ADInterstitialAdDelegate, the interstitialAd:didFailWithError:
    delegate method will be called with an ADError enum.
  • If your app implements the iAdAdditions category on UIViewController, setting the ADInterstitialPresentationPolicy will
    have no effect and calling requestInterstitialAdPresentation: or
    canDisplayBannerAds: will always return NO.
  • If your app implements the iAdPreroll category on AVPlayerViewController or the iAdPreroll category on
    MPMoviePlayerController, calling playPrerollAdWithCompletionHandler:
    will return an ADError enum.
  • When your ADBannerView delegate receives this error, your app should look for other ads (from other ad-networks).
  • Apps that implement the iAdAdditions category on UIViewController and use automatic presentation, should not notice any impact. Apps
    that manually manage the ADBannerView may see a blank space.
  • If you have implemented a mediation layer, contact the mediation provider to understand impact to your app.
  • ADClient APIs (requestAttributionDetailsWithBlock and addClientToSegments) will continue to work.

Apple also suggests removing the iAd framework on your applications next regularly scheduled update. So, submitting an update just to remove the iAd framework isn't necessary: iAd for Developers

On your next regular app update or submission, you should remove the
deprecated iAd framework and connection.

Swift: Application has iAd Configuration error

iAd was shut down on June 30th. You'll have to use something else such as AdMob.

Is there something wrong is my iAd code?

iAd is officially discontinued as of tomorrow (June 30th, 2016). I am unsure of the "sign up" process now, but I believe Apple stopped registering apps to receive ads from their network some months ago

iAd Framework issue

No, it doesn't. In fact, iAds are currently available at just a few countries, as you can check here: http://developer.apple.com/iad/

If a user from any other country than these opens up your app, no Ads will appear.

I am from Brazil and tried iAds for some time, but since my apps are mainly used by brazilians (iAds are not available here yet), I have recently switched to AdMob.

iAd App Network Discontinuation

I am developing a new app - not yet submitted, about to submit.

I emailed Apple last week to see if submitting a new app could still integrate iAds, hoping I could still use iAds until June 30, 2016.

This is the response I got:

Hi Paul,

Thanks for your interest. After June 30th, the iAd app network will
no longer be available to help monetize your app. No new apps will
be accepted into the network if you are not live already. We have
campaigns live within our network up until that date. You should
connect with another provider as an alternative to iAd. Workbench
will still be available to promote your app. Thanks for being a part
of our network.

Please go to our developer site to get the latest news regarding iAd
here

Best,

Louis

This is pretty clear. NO new apps will be approved into the iAd network.

So, in response to your questions as listed:

1) Will my current apps already in the store still be able to
show/monetize iAds?

Yes, until June 30, 2016.

2) Will new apps submitted before June 30th be able to use iAd for
monetization?

3) Will any apps submitted after June 30th be able to utilize iAd for
monetization?

No. They will not.

How to remove iAd from application, using SpriteKit and Xcode 7 beta in Swift 2?

Ok so basically a new way with better code.
First make a copy your project, just incase.
Secondly, listen and follow my instructions exactly, please.

So I posted you an answer already with the purchase code. Check that you follower the instructions there exactly as I said. Than delete All the code you have in GameScene about the ads. All of it like NSNotifcationCenter, functions, ADInterstitialAdDelegate(at top of gamescene) etc.
Than you make a new swift file in your project and you enter this code.

This is a slimmed down version of my helper, it now includes inter Ads and banner ads. To set up banner do the following. In app delegate under import UIKit you write

import iAd
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate

Still in appDelegate under the class implementation you have to create this property

var bannerAdView = ADBannerView()

The reason this goes into the appDelegate is because we are creating a shared iAdBanner. Not really needed for spritekit with 1 viewController but this is the correct way for apps with multiple viewControllers so you might as well use it.
Than copy this into your project as before.

  import iAd

class Ads: NSObject {

// MARK: - Properties
static let sharedInstance = Ads()

var presentingViewController: UIViewController!

var interAd = ADInterstitialAd()
var interAdView = UIView()
var interAdCloseButton = UIButton.buttonWithType(UIButtonType.System) as! UIButton

override init() {
super.init()

print("Ads Helper init")

preloadInterAd() // preload first interAd, they will preload automatically afterwards.
}
// MARK: - User Methods
class func showBannerAd() {
Ads.sharedInstance.loadBannerAd()
}

class func showInterAd() {
Ads.sharedInstance.showInterAd()
}

class func removeBannerAds() {
Ads.sharedInstance.removeBannerAds()
}

class func removeAllAds() {
Ads.sharedInstance.removeAllAds()
}


//MARK: - Internal Methods

// loading banner
private func loadBannerAd() {
printDebug("iAd banner loading...")
appDelegate.bannerAdView = ADBannerView(frame: presentingViewController.view.bounds)
appDelegate.bannerAdView.delegate = self
appDelegate.bannerAdView.center = CGPoint(x: CGRectGetMidX(presentingViewController.view.frame), y: CGRectGetMaxY(presentingViewController.view.frame) + (appDelegate.bannerAdView.frame.size.height / 2))
}

// preloading inter
private func preloadInterAd() {
print("iAds Inter preloading")
interAd = ADInterstitialAd()
interAd.delegate = self

interAdCloseButton.frame = CGRectMake(13, 13, 22, 22)
interAdCloseButton.layer.cornerRadius = 12
interAdCloseButton.setTitle("X", forState: .Normal)
interAdCloseButton.setTitleColor(UIColor.grayColor(), forState: .Normal)
interAdCloseButton.backgroundColor = UIColor.whiteColor()
interAdCloseButton.layer.borderColor = UIColor.grayColor().CGColor
interAdCloseButton.layer.borderWidth = 2
interAdCloseButton.addTarget(self, action: "pressedCloseButton:", forControlEvents: UIControlEvents.TouchDown) // function such as this with content in brackets need : for selector. VIP
}

private func showInterAd() {
if interAd.loaded {
print("iAds Inter showing")
presentingViewController.view.addSubview(interAdView)
interAd.presentInView(interAdView)
UIViewController.prepareInterstitialAds()
interAdView.addSubview(interAdCloseButton)

// pause game, music etc here
} else {
print("iAds Inter cannot be shown, reloading")
preloadInterAd()
}
}

// closed inter ad
func pressedCloseButton(sender: UIButton) {
interAdCloseButton.removeFromSuperview()
interAdView.removeFromSuperview()
interAd.delegate = nil

preloadInterAd()
}

// remove banner ads
private func removeBannerAds() {
appDelegate.bannerAdView.delegate = nil
appDelegate.bannerAdView.removeFromSuperview()
}

// remove all ads
private func removeAllAds() {
// banners
appDelegate.bannerAdView.delegate = nil
appDelegate.bannerAdView.removeFromSuperview()

// inter
interAdCloseButton.removeFromSuperview()
interAdView.removeFromSuperview()
interAd.delegate = nil
}
}

// MARK: iAds Banner Delegates
extension Ads: ADBannerViewDelegate {

func bannerViewWillLoadAd(banner: ADBannerView!) {
printDebug("iAds banner will load")
}

func bannerViewDidLoadAd(banner: ADBannerView!) {
printDebug("iAds banner did load, showing")
presentingViewController.view.addSubview(appDelegate.bannerAdView)
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(1.5)
appDelegate.bannerAdView.center = CGPoint(x: CGRectGetMidX(presentingViewController.view.frame), y: CGRectGetMaxY(presentingViewController.view.frame) - (appDelegate.bannerAdView.frame.size.height / 2))
UIView.commitAnimations()
}

func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
printDebug("iAds banner clicked")
// pause game , music etc here
return true
}

func bannerViewActionDidFinish(banner: ADBannerView!) {
printDebug("iAds banner closed")
// resume game, music here
}

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
printDebug("iAds banner error")
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(1.5)
appDelegate.bannerAdView.center = CGPoint(x: CGRectGetMidX(presentingViewController.view.frame), y: CGRectGetMaxY(presentingViewController.view.frame) + (appDelegate.bannerAdView.frame.size.height / 2))
appDelegate.bannerAdView.hidden = true
UIView.commitAnimations()

}
}


// MARK: - iAds Inter Delegates
extension Ads: ADInterstitialAdDelegate {

func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
print("iAds Inter did preload")
interAdView = UIView()
interAdView.frame = presentingViewController.view.bounds
}

func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
print("iAds Inter did unload")
}

func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {
print("iAds Inter error")
print(error.localizedDescription)
interAdCloseButton.removeFromSuperview()
interAdView.removeFromSuperview()
interAd.delegate = nil

preloadInterAd()
}
}

Okay. Now all you have to do is write one line of code to init this Helper and preload the first Inter (they will preload automatically afterwards.)

In your gameViewController in ViewDidLoad you call this

    // this tells the ad helper that this is the GameViewController that shows ads. 
// This step also inits the adHelper and preloads the first inter ad.
Ads.sharedInstance.presentingViewController = self

And thats it. In your GameScene in the func gameOver() or wherever you want you now simply say

Ads.showInterAd()
Ads.showBannerAd()

You can always check in the console if the Ad has preloaded as i made prinln for every step. If an ad has not preloaded it cannot be shown. This helps you understand whats happening.

In you gameViewController in the purchase code you now simply say

Ads.removeAllAds()

and all ads are removed.

If you just want to remove BannerAds, for example during gamePlay, simply say

Ads.removeBannerAds()

than load them again whenever you like with
Ads.showBannerAd()

To save a purchase you do this.

In the function removeAllAds() you say right at the end

 NSUserDefaults.standardUserDefaults().setBool(true, forKey: "your product ID")

Anywhere in your code where you will say Ads.showInterAd() or Ads.showBannerAd() like func gameOver() you write this

// You can use your product Id as a key, and you dont actually have to set a var. So its the easiest this way. If it cannot find a bool for your product ID it will automatically set it to false. Very nice.
// A reason I made the structs with the product ID is so its easier to reference it so you dont have to type it out every time.
if NSUserDefaults.standardUserDefaults().boolForKey("your product ID") == false {
Ads.showInterAd()
}

Done



Related Topics



Leave a reply



Submit