Admob not working at AppStore - app-store

I have implemented Ad mobs in my iPhone app. The app is receiving ads in simulator and device while debugging. but when i upload it to app store it is not receiving any.
I'm using this piece of code
-(void)showAds{
self.adBanner = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner
origin:origin]autorelease];
self.adBanner.adUnitID = #"abcdef1234567890.";
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
GADRequest *request = [GADRequest request];
[self.adBanner loadRequest:request];
}
I dont know what mistake m I making ?? any help ?

It looks like you have a period at the end of your adUnitID. Are you sure that should be there?

Related

Facebook comment part keep loading on UIWebView

Facebook comment part of webview keep loading and it never finish on device.
But, it works just fine on simulator.
Does somebody have an idea to fix this? Thanks in advance!
This is the code to add UIWebview on UIViewController.
NSString *address = #"http://techcrunch.com/2012/03/10/entrepreneurs-are-difficult-at-best-and-abrasive-at-worst-get-over-it/?grcc=33333Z98";
//make webview frame
webView_ = [[UIWebView alloc] init];
webView_.delegate = self;
webView_.frame = self.view.bounds;
webView_.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
webView_.scalesPageToFit = YES;
[self.view addSubview:webView_];
//load page on webview
NSURL *myURL = [NSURL URLWithString:address];
NSURLRequest *myURLReq = [NSURLRequest requestWithURL:myURL];
[webView_ loadRequest:myURLReq];
This is the error message on - (void)webView:(UIWebView *)webView didFailLoadWithError:
Error Domain=NSURLErrorDomain Code=-999 "The operation couldn't be completed. (NSURLErrorDomain error -999.)"
Update
I tested it with a clean uiwebview, since the previous build had Sharekit plugin,
but the error still exist with a new build. Also, this link is related,
First dialog after authenticating fails immediately and closes dialog
FYI, I opened a bug recently on this. Facebook hasn't really responded and oddly classified it as a "wishlist" item:
https://developers.facebook.com/bugs/373249496041875?browse=search_4fa8cf425c5aa8d66140047

Why is my AdMob code leaking in my iphone app?

I have included AdMob in my iphone app. I have the following code in my viewDidLoad method:
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
0.0,
320,
50)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = ADMOB_BANNER_UNIT_ID;
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
// Initiate a generic request to load it with an ad.
GADRequest *r = [[GADRequest alloc] init];
r.testing = YES;
[bannerView_ loadRequest:r];
[r release];
This leaks. When I comment out the second last line ( [bannerView_ loadRequest:r]; ), the leak disappears. The only thing I changed in this code from the example provided by Google was to introduce the variable r so I could put AdMob in testing mode. In the code supplied by Google, bannerView_ is released by viewDidUnload. I looked for the loadRequest method but all I found was a definition in the GADBannerView.h file. As far as I can tell, there is no GADBannerView.m file, which seems weird in itself. Anyway, any tips would be much appreciated.
Thanks,
John
Why don't you use this AdMediator - it is very simple to configure and you don't have to worry about AdMob and iAds (if you want to use it) :
will swap in AdMob ads if no iAds are
available.
Are you releasing bannerView_ in your dealloc method or somewhere else appropriate ?
Instead of:
GADRequest *r = [[GADRequest alloc] init];
You could try:
GADRequest *r = [GADRequest request];

iPhone - AdMob not appearing. Using sample code

I'm trying to add AdMob to my app.
I followed the instructions from the example from here: http://code.google.com/mobile/ads/docs/ios/fundamentals.html
with the subtle difference that I created a method and I'm calling it from the viewDidLoad
The problem is that nothing is appearing, not even an empty frame. I also tried deleting everything except the main view from Interface Builder to make sure that is not behind something but nothing is appearing.
What can I've doing wrong?
Here's my method code:
- (void)showBanner {
// Create a view of the standard size at the bottom of the screen.
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = #"heresthestringofmyadmobid";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[self.view bringSubviewToFront:bannerView_];
// Initiate a generic request to load it with an ad.
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:
GAD_SIMULATOR_ID, // Simulator
#"heresthestringofmyphone", // Test iPhone 3Gs 4.3.1
nil];
[bannerView_ loadRequest:request];
}
I also tried harcoding the CGFrame with 0, 0, 320, 50 to make it appear on top but nothing happened either
Chompas,
You could not be getting a ad because of a low fill rate or other issue. To check if this is the issue, try enabling testMode so you will always get an ad.
You can do that with something like this:
GADRequest *request = [[GADRequest alloc] init];
request.testing = YES;
[bannerView_ loadRequest:request];
-David
.testing is now deprecated. You can instead use this:
#ifdef DEBUG
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:
GAD_SIMULATOR_ID,
#"YOUR_DEVICE_IDENTIFIER",
nil];
[bannerView_ loadRequest:request];
#else
[bannerView_ loadRequest:[GADRequest request]];
#endif
If you want test ads support in your real device and not just in the emulator, YOUR_DEVICE_IDENTIFIER should be replaced by your device identifier, which you can find while your device is connected under xCode menu > Window > Organizer > Devices. It's a long hex number.
I think you missed to set the delegate for processing events like ad recieved, ad failed, etc. I made the same mistake. [adView setDelegate: )]

AdMob not showing ads in iOS simulator

I am trying to use AdMob on an app (built for iOS 4.0)
I've added the sample code available in the tutorial http://code.google.com/mobile/ads/docs/ios/fundamentals.html which is the following (I've changed the adUnitID):
// Create a view of the standard size at the bottom of the screen.
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = #"XYZ";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[self.view bringSubviewToFront:bannerView_];
GADRequest * request = [GADRequest request];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];
Doing this nothing happens, no ad is shown and the number of requests in my AdMob app page increase erratically (i.e.: I can't seem to notice a pattern), but the most important is no ad is shown.
If I add the following code:
GADRequest * request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:
GAD_SIMULATOR_ID, // Simulator
nil];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];
I get the "Success! You are now ready to travel through the App Galaxy" default banner, but only this one.
So my questions are:
Aren't the sample code enough to show ads? Why I never see an ad with the sample code?
As far as I understood, requests mean the number of times my app asked for an ad to be shown. I also understood that not every request is replied with an ad (otherwise the fill rate would be 100%), but still, I NEVER saw an ad, what am I doing wrong?
Thanks in advance.
GADBannerView *bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];//Set Position
bannerView.adUnitID = #"12331255421245";//Call your id
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView.rootViewController = self;
[self.view addSubview:bannerView];//Your attempt to add bannerview
// Initiate a generic request to load it with an ad.
[bannerView loadRequest:[GADRequest request]];
I set all above methods. Ad banner looks properly in Device but not showing ad in Simulator.
I set device Id as GAD_SIMULATOR_ID.but it doesnt work. Its delegate methods are not being called. !!
Try it in the device. Apps in simulator don't show Admob ads.

MPMoviePlayerViewController quits unexpectedly

I'm trying to get videos to play from my server on the iPhone device. I'm using the following method to do so, however, it only works in the simulator; and on my iPhone 4. It doesn't work on iPhone 3G?
If I call this method on the iPhone 3G, it opens the video modal screen, starts to load the video, and then closes the modal screen abruptly. No errors are shown in the console.
The iPhone 3G has version 4.0 installed. My iPhone 4 has version 4.1.
Has anyone else experienced this?
-(IBAction)playMedia{
NSString* url = [self.data objectForKey:#"url"];
//initialize the movie player
self.moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
//show a background image while the user waits
moviePlayerViewController.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:#"background.png"]];
moviePlayerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
//show the movie
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];
[moviePlayerViewController release];
}
ok I got video to work on both iPhone 4 and iPhone 3G. Basically the issue was the file format. I was playing a .mov file. When I changed the format to .mp4, it now works on both devices. No change in code.
Hope this helps others with the same issue.
I'd do the above a little differently:
-(IBAction)playMedia{
NSString* url = [self.data objectForKey:#"url"];
//initialize the movie player
MPMoviePlayerViewController *tmpPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
self.moviePlayerViewController = tmpPlayer;
//show a background image while the user waits
UIColor *tmpColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:#"background.png"]];
self.moviePlayerViewController.view.backgroundColor = tmpColor;
self.moviePlayerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
//show the movie
[self presentMoviePlayerViewControllerAnimated:self.moviePlayerViewController];
[tmpPlayer release];
[tmpColor release];
}