前置条件
1.必要:一台装有Mac OS X操作系统的电脑:经济允许的话可以买一部Mac book;
2.可选:一部iphone手机:如果我们开发的APP不需要“GPS”、“照相机”、“蓝牙”等功能,完全可以不用iphone真机,使用iphone模拟器即可。
注意事项
1. 一般情况下,本iOS系列文章的示例均适用模拟器调试。如果需要使用特殊硬件(GPS、蓝牙等),则必须使用真机。
2. 真机调试时,需要保证电脑和iPhone手机均能联网才能调试,因为每一次电脑下载程序到手机时,都会通过Apple公司认证授权。
环境搭建
电脑环境

Xcode
Xcode是iOS原版标配的集成开发环境,并且免费面向普罗大众。截至目前使用最新版本10.1,我们可以在App Store中轻松取之。

cocoapods安装
一、CocoaPods简介
CocoaPods负责管理iOS项目中第三方框架。CocoaPods的项目源码在Github上管理。项目从2011年8月12日开始,CocoaPods的出现使得我们可以节省设置和更新第三方开源库的时间。(练习时为了速度一般我都是直接导入工程中,个人比较讨厌写纯代码在Podfile文件中)
二、开始安装
安装需要用到Ruby,虽然Mac自带了Ruby,不过版本有点老了,最好更新一下。
打开终端:输入更新命令:sudo gem update --system

因为Ruby的软件源rubygems.org被屏蔽了,所以要更换源.
命令:
查看gem的sources:gem sources -l
替换gem的sources:gem sources --addhttps://gems.ruby-china.com/--removehttps://rubygems.org/
最终样子如图

接下来安装Cocoapods,
输入命令:sudo gem install cocoapods
如果出错:请输入命令
sudo gem install -n /usr/local/bin cocoapods
安装完成之后,查看pod版本号:
命令: pod —version
如图:

cocoapods使用(简称Pod)
创建项目

1.打开xcode。会看到如图的页面,选择第二项。创建项目。

下一步选择工程目录即可完成。


配置Pod:
打开终端输入命令:
cd到项目根目录下:cd /Users/wzk/Desktop/Test/Test
创建Podfile 命令:Vim Podfile 输入如图内容,保存就可以看见/Users/wzk/Desktop/Test/Test
下有个Podfile



然后,终端输入命令:pod install。 安装即可。
大功告成。
打包配置
1.注册开发这账号
流程:1.首先你要有一个AppID账号,登录开发者官网 https://developer.apple.com,在账号登录窗口中找到注册入口,进行账号注册AppleID(个人,公司,企业等等类型),注册时填写信息要真实,苹果会审核。
注册时填写的主要信息有姓氏、名字、国家、出生日期、邮箱、密码、密码保护问题、图片验证码,邮箱验证码。注意填写的内容必须为全英文,不得出现中文。

2.加入苹果开发者计划。
注意:1.填写相关信息、要真实。
2.如果公司、企业需要邓白氏编码,建议在苹果官网申请,一般需要一到两周时间,申请者东西要重视:不要失败三次,否则,公司会被苹果紧致掉,很头疼的事情。
3.加入苹果开发这计划的信息最好和注册AppleID信息一直。方便通过。
4.等成功后需要支付,双币信用卡。
具体参考链接:苹果开发者账号申请流程
2.证书配置
1.手动配置
如何通过key生成mac电脑签名文件打开mac钥匙串

从证书颁发机构,请求证书


2.自动管理:现在证书配置建议使用自动化管理方式,自动化管理方式,可以自动创建证书和配置文件,并且下载到电脑上的流程,方便易懂。

3.打包API
使用自动配置方式,完成后,打包方式如图:


然后下一步、下一步,就完成了。
打包App Store。
1.如果是提交appstore,需要注意:在iTunesConnect上添加此项目. 地址:https://appstoreconnect.apple.com,登陆上去:








然后填写完成,就可以提交审核了,提交审核要注意有没有使用IDFA和加密(此处加密不是接口数据加密),否则会被拒绝。
网友评论