iAd banner never gets ad in simulator - ios

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
Always gets called... and I don’t get any ads in the simulator. Its really weird because I’ve done iAds before and they are pretty straight forward.
So far I have clean/rebuilt and downloaded the profile again. If I don’t hide it ... it shows a blank ad.

When you say "Blank ad" do you mean a black and white ad that says something along the lines of "this is a test advertisement"? If so, that's what you're supposed to see--iAd only delivers test ads to the simulator. Everything's fine :)

Related

Clicking iAd restart the whole game

I am working on a sprite kit game project and I got an issue on iAd, the Ad works fine, till I not click the ad. But when i click the ad it restart my whole game, and I am using only one iAd for my entire game.
The implementation of iAd is in my UIViewController class.
I know these two methods related to my issue but I don't know how to use them:
-(BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
-(void)bannerViewActionDidFinish:(ADBannerView *)banner
I've tried every thing I know, but nothing comes out.

iOS state restoration logs warning instead of running in simulator

I have some odd behaviour in the iOS Simulator with state restoration. I've only recently realized it is only happening in the emulator. I'm wondering if there is something I am doing wrong. But I would also like to share my experience.
I created a single screen project in Xcode 5.0.2. In my application delegate I have only added two methods:
- (BOOL)application:(UIApplication *)application shouldRestoreApplicationState:(NSCoder *)coder
{
NSLog(#"I am restore.");
return YES;
} // */
- (BOOL)application:(UIApplication *)application shouldSaveApplicationState:(NSCoder *)coder
{
NSLog(#"I am save.");
return YES;
} // */
There are no other changes.
When debugging on an actual iPhone, I get both the log messages; "I am restore" on start up, and "I am save" when I press the home button to stop the app. If I comment out either one or both, I do not get any log messages. It seems that you need both methods for either to work. They don't even get called without the presence of the other.
When debugging in the iOS Simulator, (I don't know how to tell what version of the OS I'm using in the Simulator) I never get either of the log messages. If both methods are present, and only if both are present, I get "Warning: Unable to create restoration in progress marker file" showing up in my log, but I still don't get the log messages I made. So, the mere presence of both will cause a warning, but no force on Earth will allow them to be called. In the simulator. I tried adding a restoration id in the storyboard, but it didn't change anything.
I realize that Apple recommends running on an actual device and they don't guarantee similar behaviour on the simulator. But is there some setting I need to put somewhere to get state restoration working in the simulator? At one point I had it working, and I assumed that my storyboard changes had disrupted it. But with such a minimal app, I'm wondering if there is something more fundamental.
This is not a bug. These methods are called in preparation of state serialization for your app. State serialization never happens in the simulator because the app will not be terminated.
Ultimately, this is one of many differences between the simulator and actual devices. Always test on a device to ensure actual functionality.
Edit: State serialization can happen in the simulator by press the simulated 'home' key. ⌘⇧H
Often, the simulator start acting funny and the solution to most problem there is just to reset it.
In the simulator, click on the 'iOS Simulator menu' > 'Rest Content And Settings...'
I do this I think at least once a day, when the keyboard just stops responding or I get funny messages out of the blue.

Is it allowed to hide iAds even when they are available?

I need to hide iAds depending on certain conditions, regardless their availability. So, I was wondering if my app would be rejected in the case where I hide the iAd, even when there's an iAd being displayed.
iAds will not work if their alpha is set to anything other than 1, so you could simply use this code to turn them off:
ADBannerView *banner;
[banner setAlpha:0];
This is how you would remove ads in apps, too, so your app will not get rejected for doing this - again, iAds do NOT display if the alpha is set to anything other than 1, so you can't hide an iAd and have it be displayed at the same time - pretty much, when you hide an iAd it is about the equivalent to the user not having any internet connection, and the iAd being hidden.

my iad is still being displayed when I change from one screen to the next

I have successfully implemented iAd into my App just this past week, but when my fill rate was very low I looked into it, and I realize I have a problem. My iAd banner is correclty displayed on the first screen the user sees, and that is the only screen on which the banner ad is displayed by my design. I setup a singleton class to manage the ads, and I'm expanding it to display on additional screens in an upcoming release. However, when I push another view controller to the front that doesn't display ads, my iAd delegate methods:
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
- (void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
are still being called every 3 minutes as though the view is active.
Is there a way to temporarily disable iAd from trying to refresh? thanks in advance.
Since I'm not showing ads on all of the pages, I create/release the ad object when my view controller that is showing ads is displayed/not-displayed (and set the delegate to nil), and this prevents any ads/delegate functions on view controllers that are not currently displayed from being displayed.

Facebook Connect always returns app to splash screen on iPad only

As the title suggests, I have an app which uses Facebook connect to log users in.
On the iPhone this works fine; it switches to the Facebook app, logs in and then goes back to my app at the same place it left off.
However on an iPad (I only have an iPad 1 to hand but I'm presuming the problem is across all 3), when it returns to my app it seems to have restarted it entirely. It goes back to the splash screen, and then to the login screen. The user is stuck in an endless loop of "unsuccessfully" logging in, despite the fact that the Facebook app is logging in correctly.
Does anyone have any idea why this could be happening on the iPad but not an iPhone?
This app is actually inherited from a much older app which was iPhone only, and to simplify things it has essentially been left that way. The images etc are just scaled based on screen size, there is no differentiation in the code between iPhones and iPads other than their screen size. The facebook connect code has a "FBIsDeviceIPad" bool, but afaik that is just for setting the position and size of the popup login dialog when not using SSO.
Edit:
Further investigation suggests it could be an issue with OpenGL ES. The app crashes when sent to the background, as the OpenGl ES code carries on trying to animate etc. The facebook app momentarily puts my app into the background, ergo the app crashes and restarts.
I'll update this once I find out how to fix this, in the meantime if anyone has already dealt with this situation I would welcome any suggestions.
In your AppDelegate Class implement this code
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
return [facebook handleOpenURL:url];
}
For me, it was the permissions that made a difference. I had the same problem om the iPhone. and i reduced the permissions and the app stopped doing that.
Turns out it's a memory issue as noted in the question edit. Still not resolved how to get it working, but this is at least the cause of the problem.

Resources