How to put Google adsense in iPhone application?

Posted by oksk on Stack Overflow See other posts from Stack Overflow or by oksk
Published on 2010-05-30T10:41:44Z Indexed on 2010/05/30 10:42 UTC
Read the original article Hit count: 237

Filed under:
|

Hi all. I have a question about adsense. I want to put Google adsense in my application to be developed. But after testing my code, It wasn't shown.

this is my code

self.webView.userInteractionEnabled = NO;

NSMutableString *manageableHTML = [[[NSMutableString alloc] init] autorelease];

[manageableHTML appendFormat:@"<html><head></head>"];
[manageableHTML appendFormat:@"<body>"];
[manageableHTML appendFormat:@"<script type=\"text/javascript\"><!--"];
[manageableHTML appendFormat:@"window.googleAfmcRequest = {"];
[manageableHTML appendFormat:@"client: 'ca-mb-pub-7564235160823935',"];
[manageableHTML appendFormat:@"ad_type: 'text_image',"];
[manageableHTML appendFormat:@"output: 'html',"];
[manageableHTML appendFormat:@"channel: '2052458338',"];
[manageableHTML appendFormat:@"format: '320x50_mb',"];
[manageableHTML appendFormat:@"oe: 'utf8',"];
[manageableHTML appendFormat:@"color_border: '336699',"];
[manageableHTML appendFormat:@"color_bg: 'FFFFFF',"];
[manageableHTML appendFormat:@"color_link: '0000FF',"];
[manageableHTML appendFormat:@"color_text: '000000',"];
[manageableHTML appendFormat:@"color_url: '008000',"];
[manageableHTML appendFormat:@"};"];
[manageableHTML appendFormat:@"//--></script>"];
[manageableHTML appendFormat:@"<script type=\"text/javascript\" "];
[manageableHTML appendFormat:@"src=\"http://pagead2.googlesyndication.com/pagead/show_afmc_ads.js\"></script>"];
[manageableHTML appendFormat:@"</body></html>"];

[self.webView loadHTMLString:manageableHTML baseURL:nil];

[self.view addSubview:self.webView];

Bofore testing, this javascript code are well operated in my google blog. I found that this code work at only mobile device. and I checked it through safari of my ipod touch. (It works well.)

But Checking in the application, I don't see adsense. what is something wrong?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about adsense