Closed igorcarrasco closed 11 years ago
Did you clone and integrate the source yourself, or did you use cocoapods? It's very suspect that the warning you are referring to is output on line 508 and not line 521 as the warning you have pasted here specifies.
I'll need some more information to see if there is an issue. If you could, please place #define LARSADCONTROLLER_DEBUG
somewhere in your *.pch
file to enable logging, then copy/paste the full debug output.
Nothing seems to Appear:
2013-04-15 20:46:13.052 PinThis[5614:907] LARSAdController WARNING [line
521]: There are no registered ad network adapter classes. Please register
an ad network class using registerAdClass: before attempting to add ad
container view into your view heirarchy.
2013-04-15 20:46:23.866 PinThis[5614:907]
On Mon, Apr 15, 2013 at 4:50 AM, Lars Anderson notifications@github.comwrote:
Did you clone and integrate the source yourself, or did you use cocoapods? It's very suspect that the warning you are referring to is output on line 508 and not line 521 as the warning you have pasted here specifies.
I'll need some more information to see if there is an issue. If you could, please place #define LARSADCONTROLLER_DEBUG somewhere in your *.pch file to enable logging, then copy/paste the full debug output.
— Reply to this email directly or view it on GitHubhttps://github.com/larsacus/LARSAdController/issues/37#issuecomment-16366317 .
Are you using cocoa pods or did you clone the source and integrate yourself? It sounds like you didn't set the -ObjC
and -all_load
flags in your project for the AdMob framework.
Greetings,
I used the cocoapods.
I have those flags and a bunch of others set in My Project. No flag is set in the Pods Project.
best regards
On Mon, Apr 15, 2013 at 11:04 PM, Lars Anderson notifications@github.comwrote:
Are you using cocoa pods or did you clone the source and integrate yourself? It sounds like you didn't set the -ObjC and -all_load flags in your project for the AdMob framework.
— Reply to this email directly or view it on GitHubhttps://github.com/larsacus/LARSAdController/issues/37#issuecomment-16414428 .
If you're using cocoapods, you'll need to set the above #define
in your pod's prefix.pch
file to get the logs to appear.
2013-04-16 01:34:44.308 PinThis[10380:907] LARSAdController [line 187]:
View is portrait
2013-04-16 01:34:44.312 PinThis[10380:907] LARSAdController [line 210]:
Container frame: {{0, 366}, {320, 50}}
2013-04-16 01:34:44.315 PinThis[10380:907] LARSAdController WARNING [line
521]: There are no registered ad network adapter classes. Please register
an ad network class using registerAdClass: before attempting to add ad
container view into your view heirarchy.
2013-04-16 01:34:44.317 PinThis[10380:907] LARSAdController [line 717]:
Registering for orientation notifications
2013-04-16 01:34:44.318 PinThis[10380:907] LARSAdController [line 187]:
View is portrait
2013-04-16 01:34:44.320 PinThis[10380:907] LARSAdController [line 210]:
Container frame: {{0, 366}, {320, 50}}
2013-04-16 01:34:44.470 PinThis[10380:907] LARSAdController [line 743]:
Handling orientation change
2013-04-16 01:34:44.790 PinThis[10380:907] LARSAdController [line 743]:
Handling orientation change
2013-04-16 01:34:44.827 PinThis[10380:907] LARSAdController [line 187]:
View is portrait
2013-04-16 01:34:44.829 PinThis[10380:907] LARSAdController [line 210]:
Container frame: {{0, 366}, {320, 50}}
2013-04-16 01:34:44.839 PinThis[10380:907] LARSAdController [line 187]:
View is portrait
2013-04-16 01:34:44.840 PinThis[10380:907] LARSAdController [line 210]:
Container frame: {{0, 366}, {320, 50}}
2013-04-16 01:36:09.327 PinThis[10380:907] LARSAdController [line 187]:
View is portrait
2013-04-16 01:36:09.329 PinThis[10380:907] LARSAdController [line 210]:
Container frame: {{0, 366}, {320, 50}}
2013-04-16 01:36:09.331 PinThis[10380:907] LARSAdController [line 536]:
Creating new instance of adapter class "TOLAdAdapteriAds"
2013-04-16 01:36:09.333 PinThis[10380:907] LARSAdController [line 576]:
Successfully created instance of "TOLAdAdapteriAds"
2013-04-16 01:36:09.351 PinThis[10380:907] LARSAdController [line 487]:
Initial banner frame
On Tue, Apr 16, 2013 at 12:38 AM, Lars Anderson notifications@github.comwrote:
If you're using cocoapods, you'll need to set the above #define in your pod's prefix.pchfile to get the logs to appear.
— Reply to this email directly or view it on GitHubhttps://github.com/larsacus/LARSAdController/issues/37#issuecomment-16418099 .
Just looking at this short output, it appears your ads are running fine. The initial call to addAdContainerToViewInViewController:
may be being called before you are registering the ads with the system. But that doesn't make sense if you are registering the ad adapters in application:didFinishLaunching:withOptions:
. Ensure you are registering your ad adapters as soon as you can in application:didFinishLaunching:withOptions:
and see if that helps. Where is the first place you are adding an ad to your views? It seems like it's only the initial call that's getting hung up.
(BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions { // Override point for customization after application launch. UIViewController *rootController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:rootController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; [self.window setRootViewController:navigationController]; [self.window makeKeyAndVisible];
[[LARSAdController sharedManager] registerAdClass:[TOLAdAdapteriAds class]]; [[LARSAdController sharedManager] registerAdClass:[TOLAdAdapterGoogleAds class] withPublisherId:@ "xxxxxxxxxx"];
return YES; }
Is it because I alloc my root view controller and add it to the navigationcontroller before?
All my calls to the adcontroller are on:
On Tue, Apr 16, 2013 at 3:27 AM, Lars Anderson notifications@github.comwrote:
Just looking at this short output, it appears your ads are running fine. The initial call to addAdContainerToViewInViewController: may be being called before you are registering the ads with the system. But that doesn't make sense if you are registering the ad adapters in application:didFinishLaunching:withOptions:. Ensure you are registering your ad adapters as soon as you can in application:didFinishLaunching:withOptions: and see if that helps. Where is the first place you are adding an ad to your views? It seems like it's only the initial call that's getting hung up.
— Reply to this email directly or view it on GitHubhttps://github.com/larsacus/LARSAdController/issues/37#issuecomment-16423289 .
Yes. You are registering your ad adapters after you are creating your view controller and adding it to the window, which is trying to display an ad before it knows what ads it is supposed to display. Just move the call to register your ad adapters before any calls related to your view controller and you shouldn't have the issue anymore.
Thanks.
Btw I'm working in an App ATM that requires callback to when an ad is going to display,going to hide.
Right now I made my own obervers: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(adWillShow) name:@"adWillShow" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(adWillHide) name:@"adWillHide" object:nil];
And I'm trigering them:
(void)adSucceededForNetworkAdapterClass:(Class)class{
[[NSNotificationCenter defaultCenter] postNotificationName:@"adWillShow" object:self];
Is there a built in way to get notifications?
I found this in your code: /* A boolean flag that indicates if any ads are currently being displayed. @discussion Value change will be triggered when any ads have a visibility state change. Key-value observable. / @property (nonatomic, getter = isAdVisible, readonly) BOOL adVisible;
But haven't found an example on how to implement it! best regards
On Tue, Apr 16, 2013 at 2:16 PM, Lars Anderson notifications@github.comwrote:
Yes. You are registering your ad adapters after you are creating your view controller and adding it to the window, which is trying to display an ad before it knows what ads it is supposed to display. Just move the call to register your ad adapters before any calls related to your view controller and you shouldn't have the issue anymore.
— Reply to this email directly or view it on GitHubhttps://github.com/larsacus/LARSAdController/issues/37#issuecomment-16443791 .
You can add what's called a key-value observer to watch the adVisible
property for changes. I've included a key in LARSAdController.h
, kLARSAdObserverKeyPathIsAdVisible
, that you can use to observe this property. Whenever it's value changes, this means that the status of visible ads has changed.
The basics of KVO are:
Register observer:
[[LARSAdController sharedManager] addObserver:self forKeyPath:kLARSAdObserverKeyPathIsAdVisible options:NSKeyValueObservingOptionNew context:nil];
Observe changes by implementing in your observer:
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
if ([keyPath isEqualToString:kLARSAdObserverKeyPathIsAdVisible]) {
//handle change here
}
}
You can find more info about KVO here: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/KeyValueObserving/Articles/KVOBasics.html#//apple_ref/doc/uid/20002252-BAJEAIEE
I get this warning a lot of times:
LARSAdController WARNING [line 521]: There are no registered ad network adapter classes. Please register an ad network class using registerAdClass: before attempting to add ad container view into your view heirarchy.
I do register the adds in My App delegate:
I do: [[LARSAdController sharedManager] registerAdClass:[TOLAdAdapteriAds class]]; [[LARSAdController sharedManager] registerAdClass:[TOLAdAdapterGoogleAds class] withPublisherId:@"xxxxxxxxxxx"];
Any idea what might be causing this? Cause I'm probably losing a lot of ad requests. Best Regards