本文大部分内容转载至简书http://www.jianshu.com/p/9756992a35ca
博主稍加了补充和修改
一、证书管理
用Xcode8打开工程后,比较明显的就是下图了,这个是苹果的新特性,可以帮助我们自动管理证书。建议大家勾选这个Automatically manage signing

下面我来说说可能会出现的问题:
1.Xcode未设置开发者账号情况下的截图

解决办法是:大家在Xcode的偏好设置中,添加苹果账号,即可。
2.设备机器未添加进开发者的Device情况下的截图

解决办法是:大家在官网将设备添加进开发机后,陪下描述文件重新下个描述文件即可。
3.正常情况:Xcode配置登录开发者账号后的图片,耐心等待即可。

等待完成之后的图

二、Xib文件的注意事项
使用Xcode8打开xib文件后,会出现下图的提示。

大家选择Choose Device即可。之后大家会发现布局啊,frame乱了,只需要更新一下frame即可。如下图

三、代码及Api注意
使用Xcode8之后,有些代码可能就编译不过去了,具体我就说说我碰到的问题。1.UIWebView的代理方法:**注意要删除NSError前面的 nullable,否则报错。
- (void)webView:(UIWebView *)webView didFailLoadWithError:(nullable NSError *)error{ [self hideHud];}
四、代码注释不能用的解决办法
这个是因为苹果解决xcode ghost,把插件屏蔽了。解决方法打开终端,命令运行: sudo /usr/libexec/xpccachectl然后必须重启电脑后生效
注意:Xcode8内置了开启注释的功能,位置在这里

快捷键的设置在这里

貌似Xcode8取消了三方插件的功能,具体可以查阅下Xcode8 Source Editor
五、权限以及相关设置
注意,添加的时候,末尾不要有空格**我们需要打开info.plist文件添加相应权限的说明,否则程序在iOS10上会出现崩溃。具体如下图:

麦克风权限:Privacy - Microphone Usage Description 是否允许此App使用你的麦克风?
相机权限: Privacy - Camera Usage Description 是否允许此App使用你的相机?
相册权限: Privacy - Photo Library Usage Description 是否允许此App访问你的媒体资料库?
通讯录权限: Privacy - Contacts Usage Description 是否允许此App访问你的通讯录?
蓝牙权限:Privacy - Bluetooth Peripheral Usage Description 是否许允此App使用蓝牙?
语音转文字权限:Privacy - Speech Recognition Usage Description 是否允许此App使用语音识别?
日历权限:Privacy - Calendars Usage Description 是否允许此App使用日历?
定位权限:Privacy - Location When In Use Usage Description 我们需要通过您的地理位置信息获取您周边的相关数据
定位权限: Privacy - Location Always Usage Description 我们需要通过您的地理位置信息获取您周边的相关数据定位
六、字体变大,原有frame需要适配
待补充~
七、推送
如下图的部分,不要忘记打开。所有的推送平台,不管是极光还是什么的,要想收到推送,这个是必须打开的哟✌️

之后就应该可以收到推送了。另外,极光推送也推出新版本了,大家也可以更新下。
PS.苹果这次对推送做了很大的变化,希望大家多查阅查阅,处理推送的代理方法也变化了。
推送的代理[<UNUserNotificationCenterDelegate>]
iOS10收到通知不再是在[application: didReceiveRemoteNotification:]
方法去处理, iOS10推出新的代理方法,接收和处理各类通知(本地或者远程)
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
//应用在前台收到通知 NSLog(@"========%@", notification);
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
//点击通知进入应用 NSLog(@"response:%@", response);
}
八.屏蔽杂乱无章的Log日志
更新Xcode8之后,新建立工程,都会打印一堆莫名其妙看不懂的Log.如这些
subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1,
屏蔽的方法如下:Xcode8里边 Edit Scheme-> Run -> Arguments, 在Environment Variables里边添加
OS_ACTIVITY_MODE = Disable



如果写了之后还是打印log,请重新勾选对勾,就可以解决了。
网友评论