如何将Google adsense放入iPhone应用程序中?
我有一个关于 Adsense 的问题。 我想将 Google adsense 放入我要开发的应用程序中。 但测试我的代码后,它没有显示。
这是我的代码
<代码> self.webView.userInteractionEnabled = 否;
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];
测试前,这段javascript代码在我的google博客中运行良好。 我发现此代码仅适用于移动设备。 我通过 iPod touch 的 Safari 进行了检查。 (效果很好。)
但是检查应用程序时,我没有看到 adsense。 有什么问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要替代这种非法方法 - 您应该看看 AdMob,它为 iPhone 提供了可靠的应用内广告 SDK。 (http://www.admob.com)
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)