iosios5admobiadadwhirl

iAd only available in specific countries


I have setup a testing application with an Ad Banner. The ad banner is setup using AdWhirl where I use iAd and AdMob.

The application works fine and runs without errors. I am now looking to setup iAd only for the specific countries it is available within.

Within the iAd documentation it states

iAd Network recently launched in Canada. Ads are now available in apps in the U.S., Canada, U.K., Germany, Italy, Spain, France, and Japan App Stores. Be sure to configure your apps to serve ads in only these countries.

How can I configure the app to only show the iAds to users in these countries using adWhirl? I guess the first point would be to determine which ad network is serving the Ad at the time is this possible? Here is my view controller h and m if of any use, but it simply one banner at the moment for testing.

Also can this be tested that this actually works correctly? Can you change the phone simulator to act as if it where from another country?

#import <UIKit/UIKit.h>


@interface AdTestViewController : UIViewController <AdWhirlDelegate> {
    AdWhirlView *adView;
}

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic,retain) AdWhirlView *adView;

@end

imp file

#import "AdTestViewController.h"
#import "Constants.h"
#import "AdTestAppDelegate.h"
#import "AdWhirlView.h"

@interface AdTestViewController ()

@end

@implementation AdTestViewController

@synthesize adView;

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.adView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
    self.adView.autoresizingMask =
    UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin;
    [self.adView setDelegate:self];
    [self.view addSubview:self.adView];
    NSLog(@"Ad View Added");
}

#pragma mark - Delegate Methods
- (NSString *)adWhirlApplicationKey {
    NSLog(@"adWhrilApplicationKey");
    return kSampleAppKey;
}

- (UIViewController *)viewControllerForPresentingModalView {
    NSLog(@"viewControllerForPresentingModalView");
    return self;

}

- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView {
    NSLog(@"adWhrilDidReceiveAd");
    // Used to animate the ad from the top to bottom 
    //[UIView beginAnimations:@"AdWhirlDelegate.adWhirlDidReceiveAd:" context:nil];
    //[UIView setAnimationDuration:0];

    CGSize adSize = [adWhirlView actualAdSize];
    CGRect newFrame = adWhirlView.frame;
    newFrame.size = adSize;
    newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;
    newFrame.origin.y=  self.view.frame.size.height - adSize.height;
    adWhirlView.frame = newFrame;

    [UIView commitAnimations];
}

-(void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo {

}

@end

AdWhril Settings enter image description here


Solution

  • adWhirl is deprecated, and mediation feature is available in last adMob SDK now. Using it, you can switch percent of ads by ad providers to show in different countries. Check out documentation on adMob site.