Does anyone know of any working programs with Iads, all of the tutorials have deprecated functions.
here is my iAd add on: https://www.dropbox.com/sh/ct6clt8mwm8gt06/AAAdFS12AquUZOz8fJ2ULTbra
Do I have to modify the app delegate files?
When I compile your code after adding the two files to my project I get 2 errors.
Undefined symbols for architecture i386:
“OBJC_CLASS$_ADBannerView”, referenced from:
objc-class-ref in IAdsAddOn.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@austinmccoy, i think you are adding them wrong. Try following the instructions here: http://codea.io/talk/discussion/4221/objective-c-libraries-testflight-gamecenter-location-twitterfacebookcamera-roll-sharing-more#Item_74 on how to add add-ons to xcode
I am still getting the same error. I have modified the app delegate files correctly to. Any Ideas?
Would you be able to make a sample program with your addon? I could also upload my code if you needed.
EDIT: I fixed it. I had forgotten to add the framework in. Silly me.
Now i am getting the error: Cannot call global showAdFromTop()
Did you make sure you properly registered the add on to Codea?
I believe so.
All I did was add:
self.IAdsAddOn = [[IAdsAddOn alloc] init];
[self.viewController registerAddon:self.IAdsAddOn];
to AppDelegate.mm
and
#import "IAdsAddOn.h" (At Top of Script)
@property (strong, nonatomic) IAdsAddOn * IAdsAddOn;
to AppDelegate.h
I think you can’t reuse a variable name. try this:
self.iAdsAddOn = [[IAdsAddOn alloc] init];
[self.viewController registerAddon: self.iAdsAddOn];
and
#import "IAdsAddOn.h" (At Top of Script)
@property (strong, nonatomic) IAdsAddOn *iAdsAddOn;
if not something else wrong and I’ll dig out my files to show you
Thank you so much for helping me, sorry if I am an inconvenience.
Yeah, I am still receiving that same error. Would you mind showing me what you have?
Yeah, I cannot find the error.
@JakAttak Isn’t that the exact same code…?
Here are my app delegate files:
//
// AppDelegate.h
// Memory Haze
//
// Created by Théo Arrouye on Thursday, August 7, 2014
// Copyright (c) Théo Arrouye. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GameCenterAddOn.h"
#import "IAdsAddOn.h"
#import "IAPAddOn.h"
@class CodeaViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) GameCenterAddOn *gameCenterAddOn;
@property (strong, nonatomic) IAdsAddOn *iAdsAddOn;
@property (strong, nonatomic) IAPAddOn *iapAddOn;
@property (strong, nonatomic) CodeaViewController *viewController;
@end
and
//
// AppDelegate.mm
// Memory Haze
//
// Created by Théo Arrouye on Thursday, August 7, 2014
// Copyright (c) Théo Arrouye. All rights reserved.
//
#import "AppDelegate.h"
#import "CodeaViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[CodeaViewController alloc] init];
self.gameCenterAddOn = [[GameCenterAddOn alloc] init];
[self.viewController registerAddon:self.gameCenterAddOn];
self.iAdsAddOn = [[IAdsAddOn alloc] init];
[self.viewController registerAddon: self.iAdsAddOn];
self.iapAddOn = [[IAPAddOn alloc] init];
[self.viewController registerAddon:self.iapAddOn];
NSString* projectPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"MemoryHaze.codea"];
[self.viewController loadProjectAtPath:projectPath];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
}
- (void)applicationWillTerminate:(UIApplication *)application
{
}
@end
Just take out the parts for the add-ons you don’t need.
@SkyTheCoder, no I changed some capitals to lower case
Thanks, i’m no longer receiving the errors. But no ads will show.
It prints “2014-08-15 18:23:38.849 Faller[225:60b] Ads should not be shown right now” in the console on my mac even though I am calling showAdFromTop() in my setup function. What is happening?
Here is the full console:
014-08-15 18:25:09.662 Faller[233:60b] iAdAddOn Registering Functions
2014-08-15 18:25:11.147 Faller[233:60b] Banner View loaded Ads for display.
2014-08-15 18:25:11.150 Faller[233:60b] Active View Controller: CodeaViewController
2014-08-15 18:25:11.154 Faller[233:60b] Ads should not be shown right now
Have you called hideAd anywhere?