Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

adding IAds to project

edited September 2014 in General Posts: 16

I am having a lot of difficulties adding IAds to my project. I have read a lot of "How to's" on the internet but none have worked. The main problem I am having is that my project in XCode does not have a viewcontroller.m file.

I have had no problems adding IAds to a new project because I can add in the IAds code into the viewcontroller.m file.

I have looked at other solution such as the codea tutorial on this subject but i get a different problem. The tutorial asks me to add IAdAddOn.h but this is not recognised in my project (even though I have imported the IAds framework).

Has anyone else encountered these issues or am i just being stupid

Any help would be greatly appreciated.



  • Hi,

    Would you be able to upload your code so I can see it. If you could, I bet i could fix it since I've implemented Iads numerous times.

  • Hi, Thanks for responding.

    What part of my code would you need to see?

    I have been able to implement IAds into another project by including this code in the Viewcontroller.m file. But for some reason I don't have the Viewcontroller.m file in my codea project.

    import "ViewController.h"

    import <iAd/iAd.h>

    @interface ViewController ()


    @implementation ViewController

    • (void)viewDidLoad
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.

    • (void)viewDidAppear: (BOOL)animated
      [super viewDidAppear:animated];

      ADBannerView *adView = [[ADBannerView alloc]
      initWithFrame:CGRectMake(0, self.view.frame.size.height - 50, 320, 50)];
      [self.view addSubview:adView];

    • (void)didReceiveMemoryWarning
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.



  • edited September 2014 Posts: 145

    I think the viewcontroller.m/.h was deprecated. If not, someone correct me. I reccomend looking at Zoyt's add on. If you want I can upload a project with Iad's integrated. I use this as a template when creating apps, would you like to see it?

  • That would be a big help.


  • I have another one with Iads and Gamecenter integrated. Would you like that instead?

  • Yeah sounds good

  • Ill go dig it up and post it with a link in the next hour.

  • Brilliant. Thanks

  • Hi,

    Thanks for uploading this, I have managed to access the project and from what I can see, I need to add the IAdsAddon.m and .h files to my project. I notice that the Codea part of your code is empty, presumably this is so that I can just add my code to the project? I'm not sure what I need to add to my code so that I can show the Advert.

    Thanks for you help so far.

  • Yes indeed. If you look at Iadsaddon.h you will see the functions showAdFromBottom() showAdFromTop() and hideAd() -Capitalization may be off. Just call one of these functions in your codea an walla!

  • Thats great, I have managed to get iAds to show in my app now. however, my app is landscape view and the add only stretches 3/4 of the way across the screen. can this be corrected?

  • I would message Zoyt since he created the add on, I just set it up and fixed some bugs.

  • Posts: 2,051

    @jonesy166, there's no good way to fix this without using deprecated code. If you rotate into portrait and then back to landscape it will fix itself to be the correct size.

  • Thanks for your help guys. I managed to get this sorted. My app is being reviewed by apple so finger crossed should be released soon, follow me @tapthestar for updates

  • Good luck! I will be sure to check this out!

Sign In or Register to comment.