今天就带大家走一个制作一款能够帮你赚钱的App的流程
个人App 最简单的赚钱方式就是广告和内购,今天就演示一下广告的投放过程
项目名称 - 看谁最年轻
- 需求
1.识别图片中多张人脸的年龄
2.有分享功能
3.用评分功能
4.投放Google广告
第一步 准备工作
-
注册第三方分享(微信,微博,QQ)
第二步 创建工程添加第三方SDK
- 可以通过手动添加的方式或者cocosPod 的方式
![](https://img.haomeiwen.com/i1594482/131130999b2a18fa.png)
第三 我着重讲讲Face++ Api 的使用和 google广告的接入
- Face ++ 部分
1.配置
func setupFaceAPI(){
FaceppAPI.initWithApiKey("你申请的key",andApiSecret: "你申请的ApiSecret", andRegion: APIServerRegionCN)
}
2.识别- 识别出来的信息为一个json 对里面的数据进行解析即可
let result = FaceppAPI.detection().detect(withURL: nil, orImageData: UIImageJPEGRepresentation(image, 0.5), mode: FaceppDetectionModeNormal, attribute: FaceppDetectionAttribute(FaceppDetectionAttributeAll))
- Google 广告部分
1.在界面上添加一个view继承GADBannerView
@IBOutlet weak var bannerView: GADBannerView!
2.配置
bannerView.rootViewController = self
bannerView.adUnitID = "ca-app-pub-3629819764559170/2076100441"
bannerView.isAutoloadEnabled = true;
let request = GADRequest()
bannerView.load(request)
- 这样就完成了,给出几张识别出来的图片截图
看谁最年轻下载地址
你学会了吗?
![](https://img.haomeiwen.com/i1594482/e6d05d23917ad017.png)
点赞数超过200奉上源码!
网友评论