如何将Google adsense放入iPhone应用程序中?

发布于 2024-09-03 03:58:35 字数 1759 浏览 5 评论 0原文

我有一个关于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花期渐远 2024-09-10 03:58:35

如果您想要替代这种非法方法 - 您应该看看 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文