Hi everyone,
I’ve been “developing” a game using Codea for some time now, GREAT tool! now i am finished with my game and i want to implement Ads (iAds i suppose). I’ve read all the tutorials i could find, but i cannot get it to work. can you please help?
It seems the exported x-code project has the iAdsAddOn already implemented (at least i can see files in Xcode). following the latest tutorial on codeatuts (tutorial 29), it seems it is out of date. for example in the tutorial the addon file is IAdsAddon.h (with CAPITAL “I”), in the exported project there it’s named “iAdsAddon.h”. Same for the CodeaViewController which now seems to be StandaloneCodeaViewController.
Is there any up-to-date document about how to implement iAds with the current version of “export to Xcode Projects”?
I tried to follow the tutorial and fix the naming issues myself, the app builds fine, but code runtime gives an error "attempt to call a nil value (global ‘showAdFromTop’).
here is the code (please let me know if you need more):
//
// AppDelegate.h
// Killemann
//
// Created by Alexander Neujahr on Sonntag, 2. Oktober 2016
// Copyright (c) Alexander Neujahr. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "iAdsAddon.h"
@class StandaloneCodeaViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) iAdsAddon *iAdsAddOn;
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) StandaloneCodeaViewController *viewController;
@end
and here is the start of AppDelegate.mm
//
// AppDelegate.mm
// Killemann
//
// Created by Alexander Neujahr on Sonntag, 2. Oktober 2016
// Copyright (c) Alexander Neujahr. All rights reserved.
//
#import "AppDelegate.h"
#import "StandaloneCodeaViewController.h"
#import "GameCenterAddon.h"
#import "iAdsAddon.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Create and add our iAdsAddOn to Codea
self.iAdsAddOn = [[iAdsAddon alloc] init];
[self.viewController registerAddon: self.iAdsAddOn];
NSString* projectPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Killemann.codea"];
i didn’t change anything in the addon files…
i call showBannerFromTop in the setup() of main.lua
thx a lot for your help in advance!
Kind Regards,
jff2