苹果 iAd 编程相关资料

来源:互联网 发布:工业设计知乎 编辑:程序博客网 时间:2024/04/28 17:18
How to Add iAd Banner in iPhone App
http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/

来自cocoachina.com的资料
1.苹果 iAd 移动广告系统知识汇总
http://www.cocoachina.com/appstore/top/2010/0628/1762.html

有比较详细的介绍及示例代码下载

2.让iAd 在取不到广告时隐藏广告条的方法
http://www.cocoachina.com/iphonedev/sdk/2010/0714/1863.html


3.已用iAd.framework,怎么让程序仍然在3.x下运行。
http://www.cocoachina.com/bbs/read.php?tid-24414-page-1.html
该贴子的第二页,有解决方法


iPhone弹出基于Phonegap的工程的Admob广告

Phonegap和Admob的相关知识就不说了,如果用到了就肯定知道的,这里直接说步骤。

第一步:打开XCode,新建一个基于Phonegap的工程。

第二步:加入Admob的相关头文件和.a文件。(至于怎么添加,参考我的文章:XCode添加第三方库)

第三步:在AppDelegate的头文件中加入#import "GADBannerView.h"

第四步:在AppDelegate的头文件中声明一个实例变量GADBannerView *GbannerView;

第五步:在AppDelegate.m文件中的webViewDidFinishLoad函数内部加入如下代码


    GbannerView = [[GADBannerView alloc]init];
    [GbannerView setDelegate:self];
    [GbannerView setFrame:CGRectMake(0, 0, 320, 50)];    
    
    GbannerView.adUnitID =@"你申请的Admob发布者的ID";//我的是a14f0aabcbd12cd,要是不介意,就帮我打广告吧!
    
    GbannerView.rootViewController = self.viewController;
    GbannerView.backgroundColor = [UIColor greenColor];
    [self.viewController.view addSubview:GbannerView];
    
    [GbannerView loadRequest:[GADRequest request]];


第六步:打开PhoneGap.plist,找到ExternalHots,一般情况下是0 Items
点击旁边的“+”,新增一个Item,输入*

(如果不加这一步,就会报ERROR whitelist rejection错)


0 0
原创粉丝点击