2018.07.02
创建iOS示例工程
建工程
- Xcode新建xcworkspace
- workspace里创建project
- Finder里把xcworkspace文件放入project文件夹中
- 重新打开xcworkspace,里面project找不到
- Finder里把.prject拖入Xcode
- 工程建好了,默认建立了AppDelegate,ViewController
- 打开一个.m,显示右侧Project Docment,添加Class Prefix为“mm”,这样新建的class就有自动的前缀
- 建立Base目录,存basenav和basevc
- 建立Modules目录,存各种逻辑
设置启动
- general里设置Display Name
- general里Main interface清空
- AppDelegate中启动打印,启动后看到打印消息111即可
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSLog(@"111");
return YES;
}
设置info
- View controller-based status bar appearance - NO
- Privacy - Camera Usage Description - xxx访问相机
- Privacy - Microphone Usage Description - xxx访问麦克风
- Privacy - Photo Library Additions Usage Description - xxx访问图片
- Privacy - Photo Library Usage Description - xxx访问相册
- Privacy - Location When In Use Usage Description - xxx使用期间获取位置
建立pch
- 创建group目录Supporting Files
- 下面创建pch,mmPrefixHeader.pch
- general的Build Settings里Prefix Header设置$(SRCROOT)/ocex/Supporting Files/mmPrefixHeader.pch
配置Pod
- 进入project目录,运行pod install生成Podfile
- 文本编辑器修改Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target ‘ocex’ do
pod 'MBProgressHUD'
end
- 运行pod install
- 重启xcworkspace,出现Pod工程
网友评论