xcode8的一些变动
来源:互联网 发布:看报纸的软件 编辑:程序博客网 时间:2024/04/28 07:12
一、证书管理
用Xcode8打开工程后,比较明显的就是下图了,这个是苹果的新特性,可以帮助我们自动管理证书。建议大家勾选这个Automatically manage signing(Ps.但是在beat2版本我用的时候,完全不可以,GM版本竟然神奇的又好了。)
下面我来说说可能会出现的问题:
1.Xcode未设置开发者账号情况下的截图
解决办法是:大家在Xcode的偏好设置中,添加苹果账号,即可。
2.设备机器未添加进开发者的Device情况下的截图
解决办法是:大家在官网将设备添加进开发机后,陪下描述文件重新下个描述文件即可。
3.正常情况:Xcode配置登录开发者账号后的图片,耐心等待即可。
等待完成之后的图
二、Xib文件的注意事项
使用Xcode8打开xib文件后,会出现下图的提示。
大家选择Choose Device即可。
之后大家会发现布局啊,frame乱了,只需要更新一下frame即可。如下图
- 注意:如果按上面的步骤操作后,在用Xcode7打开Xib会报一下错误,
- 解决办法:需要删除Xib里面
<code class="xml" style="margin: 0px; padding: 0px;"><<span class="hljs-title" style="margin: 0px; padding: 0px; color: rgb(163, 21, 21); line-height: 1.5;">capability <span class="hljs-attribute" style="margin: 0px; padding: 0px; line-height: 1.5;">name=<span class="hljs-value" style="margin: 0px; padding: 0px; line-height: 1.5;">"documents saved in the Xcode 8 format" <span class="hljs-attribute" style="margin: 0px; padding: 0px; line-height: 1.5;">minToolsVersion=<span class="hljs-value" style="margin: 0px; padding: 0px; line-height: 1.5;">"8.0"/></span></span></span></span></span></code>
这句话,以及把< document >中的toolsVersion和< plugIn >中的version改成你正常的xib文件中的值
,不过不建议这么做,在Xcode8出来后,希望大家都快速上手,全员更新。这就跟Xcode5到Xcode6一样,有变动,但是还是要尽早学习,尽快适应哟!
三、代码及Api注意
使用Xcode8之后,有些代码可能就编译不过去了,具体我就说说我碰到的问题。
1.UIWebView的代理方法:
**注意要删除NSError前面的 nullable,否则报错。
<code class="objectivec" style="margin: 0px; padding: 0px;">- (<span class="hljs-keyword" style="color: rgb(0, 0, 255); margin: 0px; padding: 0px; line-height: 1.5;">void)webView:(<span class="hljs-built_in" style="color: rgb(102, 0, 102); margin: 0px; padding: 0px; line-height: 1.5;">UIWebView *)webView didFailLoadWithError:(nullable <span class="hljs-built_in" style="margin: 0px; padding: 0px; line-height: 1.5;">NSError *)error{ [<span class="hljs-keyword" style="color: rgb(0, 0, 136); margin: 0px; padding: 0px; line-height: 1.5;">self hideHud];}</span></span></span></span></code>
四、代码注释不能用的解决办法
这个是因为苹果解决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需要适配
经有的朋友提醒,发现程序内原来2个字的宽度是24,现在2个字需要27的宽度来显示了。。
希望有解决办法的朋友,评论告我一下耶,谢谢啦
七、推送
如下图的部分,不要忘记打开。所有的推送平台,不管是极光还是什么的,要想收到推送,这个是必须打开的哟✌️
之后就应该可以收到推送了。另外,极光推送也推出新版本了,大家也可以更新下。
PS.苹果这次对推送做了很大的变化,希望大家多查阅查阅,处理推送的代理方法也变化了。
<code class="objectivec" style="margin: 0px; padding: 0px;"><span class="hljs-comment" style="color: green; margin: 0px; padding: 0px; line-height: 1.5;">// 推送的代理[<UNUserNotificationCenterDelegate>]</span></code>
iOS10收到通知不再是在[application: didReceiveRemoteNotification:]
方法去处理, iOS10推出新的代理方法,接收和处理各类通知(本地或者远程)
<code class="css" style="margin: 0px; padding: 0px;"><span class="hljs-tag" style="color: rgb(0, 0, 255); margin: 0px; padding: 0px; line-height: 1.5;">- (<span class="hljs-tag" style="color: rgb(0, 0, 0); margin: 0px; padding: 0px; line-height: 1.5;">void)<span class="hljs-rule" style="margin: 0px; padding: 0px; line-height: 1.5;"><span class="hljs-attribute" style="color: rgb(163, 21, 21); margin: 0px; padding: 0px; line-height: 1.5;">userNotificationCenter:<span class="hljs-value" style="color: rgb(0, 136, 0); margin: 0px; padding: 0px; line-height: 1.5;">(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { //应用在前台收到通知 <span class="hljs-function" style="color: rgb(0, 102, 102); margin: 0px; padding: 0px; line-height: 1.5;">NSLog(@<span class="hljs-string" style="color: rgb(0, 136, 0); margin: 0px; padding: 0px; line-height: 1.5;">"========%@", notification);}<span class="hljs-tag" style="color: rgb(0, 0, 255); margin: 0px; padding: 0px; line-height: 1.5;">- (<span class="hljs-tag" style="color: rgb(0, 0, 0); margin: 0px; padding: 0px; line-height: 1.5;">void)<span class="hljs-rule" style="margin: 0px; padding: 0px; line-height: 1.5;"><span class="hljs-attribute" style="color: rgb(163, 21, 21); margin: 0px; padding: 0px; line-height: 1.5;">userNotificationCenter:<span class="hljs-value" style="color: rgb(0, 136, 0); margin: 0px; padding: 0px; line-height: 1.5;">(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler { //点击通知进入应用 <span class="hljs-function" style="color: rgb(0, 102, 102); margin: 0px; padding: 0px; line-height: 1.5;">NSLog(@<span class="hljs-string" style="color: rgb(0, 136, 0); margin: 0px; padding: 0px; line-height: 1.5;">"response:%@", response);}</span></span></span></span></span></span></span></span></span></span></span></span></span></span></code>
稍后我会更新文章,对推送做一个详细的讲解。
8.屏蔽杂乱无章的bug
更新Xcode8之后,新建立工程,都会打印一堆莫名其妙看不懂的Log.
如这些
<code class="cpp" style="margin: 0px; padding: 0px;">subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: <span class="hljs-number" style="color: rgb(0, 102, 102); margin: 0px; padding: 0px; line-height: 1.5;">0, persist_level: <span class="hljs-number" style="margin: 0px; padding: 0px; line-height: 1.5;">0, default_ttl: <span class="hljs-number" style="margin: 0px; padding: 0px; line-height: 1.5;">0, info_ttl: <span class="hljs-number" style="margin: 0px; padding: 0px; line-height: 1.5;">0, debug_ttl: <span class="hljs-number" style="margin: 0px; padding: 0px; line-height: 1.5;">0, generate_symptoms: <span class="hljs-number" style="margin: 0px; padding: 0px; line-height: 1.5;">0, enable_oversize: <span class="hljs-number" style="margin: 0px; padding: 0px; line-height: 1.5;">1,</span></span></span></span></span></span></span></code>
屏蔽的方法如下:
Xcode8里边 Edit Scheme-> Run -> Arguments, 或者用快捷键打开:ctrl+shift+<,在Environment Variables里边添加
OS_ACTIVITY_MODE = Disable
如果写了之后还是打印log,请重新勾选对勾,就可以解决了
- xcode8的一些变动
- xcode8的一些变动
- xcode8的一些变动
- xcode8的一些变动得一些坑!
- centos7的一些变动
- Xcode8的一些变化
- Xcode8的一些设置
- Xcode8遇到的一些问题
- Xcode8出现的一些常见问题
- 关于团队的一些小小变动
- 更新Xcode8遇到的一些问题总结
- Xcode8更新后的一些问题解决
- 总结升级Xcode8的一些坑
- xcode8 的一些问题 注释 控制台
- 记录一下Xcode8的一些混蛋事
- Xcode8升级之后遇到的一些坑
- Xcode6- 一些变动
- jquery一些变动1.9+
- c++异常处理机制
- CSS 基础(012_浮动)
- 安卓 SQLite数据库操作实例
- 全栈工程师学习Linux技术的忠告
- 元素,单行文字或多行文字,图片 之 水平垂直居中的方法大全及例子分析
- xcode8的一些变动
- 自定义listview中android:descendantFocusability的属性作用
- iOS动画效果和实现
- 设计模式笔记-装饰者模式
- 跳转界面加载 进度条
- 2039 骑马修栅栏 USACO[图论—欧拉路]
- ssh中Connection is read-only问题的产生原因与解决方法
- 异常处理机制
- 平时在工作或上网时看到的好书