开发者

How to put Google adsense in iPhone application?

开发者 https://www.devze.com 2023-01-02 03:41 出处:网络
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.

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?


in case you want an alternative for this illegal method - you should take a look at AdMob, which provides a solid in-app ads SDK for iPhone. (http://www.admob.com)

0

精彩评论

暂无评论...
验证码 换一张
取 消