iOS11开发新增功能大全
iOS11开发新增功能大全转载请标注出处前言2017年6月6日凌晨一点(北京时间),苹果在2017WWDC大会上发布了全新的iOS11系统。可能大家印象比较深刻的就是iOS11新增了增强现实的框架ARKit和安卓玩了几十年都玩烂了的文件管理系统,那么除此之外iOS11又新增了哪些功能呢?这正是文本要介绍的。本文翻译自苹果官方iOS11发行说明文档:http://adcdownload.app
iOS11开发新增功能大全
- 转载请标注出处:http://blog.csdn.net/u013263917/article/details/72895728,以及版权归属黑马程序员:http://www.itheima.com
前言
2017年6月6日凌晨一点(北京时间),苹果在2017WWDC大会上发布了全新的iOS11系统。可能大家印象比较深刻的就是
iOS11
新增了增强现实的框架ARKit
和安卓玩了几十年都玩烂了的文件管理系统
,那么除此之外iOS11
又新增了哪些功能呢?这正是文本要介绍的。本文翻译自苹果官方
iOS11发行说明文档
:http://adcdownload.apple.com/Documentation/Beta_Release_Notes_Jun_5_2017/iOS_11_beta_Release_Notes.pdf,由于很难做到逐条测试,如果翻译有误还请多多指教.- 凡是没有
原文
标示的均是笔者的翻译,小括号内的文字是笔者的见解,凡是带原文
标示的英文均是苹果文档的原文,英文后面的小括号是苹果官网文档说明编号,类似于identifier - 有一些不是特别重要,基本上对于我们开发没有什么用处的,我就忽略了,所以本文中所有的内容都是与我们iOS开发人员相关的功能大全
- 凡是没有
1.彻底废弃32位APP(32-bit Apps)
(1)开发者从iOS11之后再也不用学习32位的APP开发了
原文:Selecting Learn More from the prompt after tapping on a already installed 32-bit app does nothing. (32340711)
(2)如果从iTunes同步32位的APP会留下一个占位符APP(言外之意就是在iOS11后如果通过iTunes同步一个32位的APP到你的iOS社会只会留下一个空白的APP,无法运行)
原文:Syncing 32-bit apps via iTunes leaves a placeholder for the app. (32356790)
(3)如果在Xcode的target中勾选系统版本为iOS10或者之前的系统,将会继续兼容32位APP(再次强调只是iOS11不支持32位而已,iOS10及以下还是继续兼容)
原文:iOS apps may target iOS 10 or earlier to continue including a 32-bit slice. (31597913)
从iOS11开始,32位的APP正式退出历史舞台
2.3D Touch
- (1)对于能识别到是电话号码,地址等能够响应系统事件的文本对象(比如点击号码自动拨号),3D Touch不生效
原文:Using 3D Touch with data detectors (phone numbers, addresses, etc.) does not work. (30504832)
3. 第三方应用 (3rd Party Apps)
这里比较多,对开发而言意义不大,我就捡几条重点的说了
(1)使用Facebook Messenger之前必须要安装Facebook应用(国内扑街)
原文:Facebook Messenger doesn't launch without the Facebook app installed
(2)最重要:第三方键盘如果没有选择
允许完全访问
有可能会出现崩溃问题(iOS10之后苹果支持第三方键盘,具体设置在通用——键盘选项中)原文:Third-party keyboards may crash if not allowed full access.
(3)如果是Skyce通过可能会让音频播放掉线(静音)
原文:The audio may drop during Skype calls. (32434672)
4.ARKit框架
ARKit是iOS11的最大亮点,笔者将会在后续同步刷新ARKit框架开发教程
(1)两件事,一是在调试
ARSession
的时候如果打短信的时候就会导致出现VIO 断点的情况(就是访问硬件内存泄露的一种崩溃断点,不打的话程序就不会有问题) 二是在AR增强现实中的锚点是不可见的(理解比较困难,笔者将会在后续更新ARKit框架学习和开发博客供读者学习交流)原文:Continuing from a breakpoint while debugging an ARSession may result in VIO breaking. Any visual objects placed in the world/anchor are not visible. (31561202)
(2)
ARSessionConfiguration
(该类主要负责跟踪AR设备方向的一些高级配置)类只有在A9芯片设备(iPhone6s)及iOS11系统之后才会生效原文:ARSessionConfiguration is only supported on iOS devices with an A9 or later processor and will be enabled for all iOS 11 devices in a future beta.
(3)
ARWorldTrackingSessionConfiguration
(该类负责:配置跟踪设备的方向和位置,以及检测设备摄像头看到的现实世界的表面)也是要A9芯片及以后,同上原文:ARWorldTrackingSessionConfiguration is only supported on iOS devices with an A9 or later processor.
5.AVFoundation
- AVFoundation更新比较多,但是设计的内容比较少,主要是在自定义相机环节开始全面支持双摄像头物理变焦的摄像头捕捉到的高清图像(为即将要发布的iPhone8做准备,其实这个对象在iOS10已经出来,当时只有7plus才有双摄像头所以开发中用的极少)
- 这里笔者就不一一翻译了,就是自定义相机中几个iOS10新增的API以前返回的nil现在做了优化
• TheCGImageRepresentationandpreviewCGImageRepresentationmethodsof AVCapturePhoto always return nil. In a future beta, they will return non-nil values. For more detail, see the documentation. (31392054)
• AVCapturePhoto returns nil when accessing the fileDataRepresentation property of an uncompressed buffer (420f/420v/BGRA), instead of a TIFF file format representation. (31902960)
• ThecameraCalibrationDatapropertyofAVCapturePhotoreturnsnilwhen cameraCalibrationDataDeliveryEnabled is set to true, unless you also set depthDataDeliveryEnabled to true. In a future beta, you’ll be able to request dual photo capture and camera calibration data capture and receive wide and telephoto buffers plus the camera calibration data for both (without being zoomed to 2x and delivering depth data to the photo). (32209427)
• ThevaluesofthelensDistortionLookupTableand inverseLensDistortionLookupTable properties of AVCameraCalibrationData are erroneously centered around 1.0. This means that a point along the radius with no elongation or shrinkage is reported as 1.0. In a future beta, the values in this lookup table will change: 0 will mean no elongation or shrinkage. (32339695)
Copyright © 2017 Apple Inc. All Rights Reserved. Page 5 of 16
• Still capture requests fail and the video stream stops producing a buffer when using the 720p30 video format with the depthDataDeliveryEnabled property of AVCapturePhotoSettings set to true. (32060882)
• Depthvaluesinthenon-default160x120and160x90depthdataformatsarehalfofthe expected values and disparity values are twice the expected value. (32363942)
6.蓝牙框架(Bluetooth)
- 大概意思就是测试版的系统(正式版要到17年9月份发布)蓝牙不稳定,iAP协议是苹果官方的蓝牙4.0协议
• Bluetooth accessories using Wireless iAP protocol may see connection issues in certain cases. (31439542)
• This beta contains headers for the LE L2CAP channel feature. Full functionality will be available in the a later beta. (32493297)
7.日历框架(EventKit)
- (1)将数据存储到一个非默认的响应事件可能会失败
Storing data to a non default event store in EventKit may not work. (31335830)
8.Foundation框架
主要更新在网络请求
URLSessionTask
这一部分- 第三点相当牛逼,网络请求能够等待安全网络才请求,这对于开发而言意义重大。笔者将会在后期上代码测试
(1)比较长,大概的意思就是加了一些API,支持应用程序退后后台时仍然能与你的Watch(苹果手表)通讯。(苹果手表网络请求依赖于手机连接的wifi)
Added a scheduling API to URLSessionTaskthat allows background URLSession clients to schedule tasks in the future, enabling easy background app refresh semantics for apps, watchOS complications, and more. The API also allows developers to update requests before transmission to address cases where the request has become stale when scheduled in the future. Additions include the earliestBeginDate, countOfBytesClientExpectsToSend, and countOfBytesClientExpectsToReceive properties of URSessionTask, and the URLSession:task:willBeginDelayedRequest:completionHandler method of URLSessionTaskDelegate protocol. (27866330)
(2)获取网络下载进度建议使用新属性
URLSessionTask adopts the ProgressReporting protocol providing a consistent mechanism for URLSession clients to track the progress of URLSessionTask using the new progress property. (30834550)
(3)添加了一个更加灵活的网络请求API,它能够等待直到你的手机连接上了安全的网络,如果是不安全的网络则该网络请求不会调用
Added an Adaptable Connectivity API to URLSession that enables tasks to automatically monitor and wait for satisfactory network connectivity, instead of immediately failing with an error when connectivity is unsatisfactory. Additions include the waitsForConnectivity property of URLSessionConfiguration and the URLSession:taskIsWaitingForConnectivity: method of the URLSessionTaskDelegate protocol
(4)添加了APP应用程序加载网络时的一些数据编码支持。(对开发意义不大,后面一大堆是举例说明,br指的是web前端的换行标签)
Added support for HTTP brotli content encoding to URLSession. By default, HTTP requests contain a br value (in addition to gzip and deflate) for the Accept-Encoding HTTP header, informing the web server that the user agent supports brotli encoding. The web server can send an HTTP body with Content-Encoding: br in the HTTP header to indicate that the content is brotli-encoded. URLSession automatically decompresses the HTTP body data and passes the decoded data back to the client in the same way it does for Content-Encoding: gzip. For binary compatibility reasons, URLSession brotli support is enabled only for apps built using the iOS 11 SDK. (27724985)
最后一个环节是iOS开发中一半以上代码都出自这个框架,大家猜到了么? 不错!就是
UIKit框架
- UIKit框架在iOS11中解决了一个
UITableView
问题,新增了一堆代码(主要与新功能文件管理有关)
- UIKit框架在iOS11中解决了一个
9.UIKit框架
- 本次iOS11系统更新UIKit较多,主要是因为iOS11新增的文件管理功能并没有提供单独的框架,而是被直接继承在UIKit框架中,测试版问题比较多,实际还是以正式版为准
- 关于iOS11文件管理功能的开发,笔者将会后续提供教程学习交流
- 此次iOS11关于UITableView的优化也比较多,笔者将会在后续深入研究探索供大家学习交流
问题修复
- 设置
UITableView
的delaysContentTouches
延迟响应属性为NO,再也不会立即触发cell的响应事件(delaysContentTouches是UIScrollerView的属性,叫做延迟响应处理。默认为YES延迟处理,作用就是当点击scrollerview中的按钮时不会被系统判定为ScrollerView的滚动手势,对这个属性不了解的小白们可以百度哈,这里笔者不再详细累述)
Setting the delaysContentTouches property of UITableView to false now works correctly and results in cells highlighting immediately on a touch down event. (27102830)
新的变化
(1)UIDocumentBrowserViewController(显示沙盒文件浏览器)不会显示UIDocumentPickerExtensionViewController列表中的应用程序扩展来源。虽然这些会在将在的测试版中重新启用,请考虑使用一个NSFileProviderExtension相反,因为它们是集成在UIDocumentBrowserViewController而不是在一个单独的表
UIDocumentBrowserViewController does not show UIDocumentPickerExtensionViewController app extensions in the list of sources. While these will be re-enabled in a future beta, please consider using an NSFileProviderExtension instead, as they are integrated in UIDocumentBrowserViewController instead of being presented in a separate sheet. (31975976)
(2)当拖动文件超过5项,文件移动/取消动画使用一个默认的动画。前五个文件夹系统调用移动/取消预览视图,即使它们没有使用。在后面的测试,系统不会让这些调用,而不是为动画提供了一个额外的API与项目的自定义动画不能应用。
When dragging more than 5 items, the drop/cancel animation uses a default animation. The system calls the dropping/cancelling preview calls for the first 5 of these items, even though they are not used. In a later beta, the system will not make these calls, and instead provides an additional API for animating alongside items for which a custom animation cannot be applied. (32299785)
(3)使用UITargetedDragPreview和UIDragPreview而不是UIURLDragPreviewView,因为在下一个版本中这个API将会被移除(移除并不意味着消失,有可能在测试版中开发,正式版中成了私有API)
Do not use the class UIURLDragPreviewView as it will be removed in a later beta.To make drag previews of URLs, use UIDragPreview and UITargetedDragPreview. (32306613)
(4)在storyboard或者xib中,Xcode9之后的tableview显示cell和header和footer将会更加的区分明显(实际上就是storyboard的显示细节小优化)
Table views in Interface Builder documents compiled with Xcode 9.0 may have fixed heights for rows, section headers, and section footers, and may not self-size by default. (32188814)
(5)在iOS11中UITableView有了一个新的系统手势可以快速选择行:两根手指快速的轻击cell,可以同时选中两个cell进入编辑状态。如果两个手指存在不同步问题,则会默认识别其中的一个手指表示单选cell
UITableView has a new system gesture for quickly selecting rows. A two-finger tap on table views that support multiple selection sets the table view to editing, if it is not already, and select the tapped row. Unlike a single-finger tap, which toggles selection, the two- finger tap always selects the tapped row and has no effect if the row is already selected. This new gesture is enabled only in apps built for iOS 11. (29127664)
(6)UITableView新增了一个属性
separatorInsetReference
,作用是可以自定义一个cell分割线的边距UITableView has a new property, separatorInsetReference, that changes how a custom value set in the separatorInset property is interpreted. By default, the value is .fromCellEdges, which means that custom separatorInset values are always interpreted as an inset from the edges of the cell, even in cases where table view would normally use larger automatic insets for the separator, such as a very wide table view when the cellLayoutMarginsFollowReadableWidth property is true
Set the separatorInsetReference to .fromAutomaticInsets to use the separatorInset as a fixed distance from the automatic inset that a table view would normally use
Note that you can always use UITableViewAutomaticDimension for any edge of the separatorInset that you set, to receive the automatic inset on that edge. (31000402)
(7)iOS11中,UITableView的cell或者表头表尾默认采用自适应高度的方案,当然如果之前的tableview不想使用这个功能可以直接禁掉,或者在自适应高度代理中返回0即可
Table views now use estimated heights by default, which also means that cells and section header/footer views now self-size by default. The default value of the estimatedRowHeight, estimatedSectionHeaderHeight, and estimatedSectionFooterHeight properties is now UITableViewAutomaticDimension, which means the table view selects an estimated height to use. You should still provide a more accurate estimate for each property if possible, which is your best guess of the average value of the actual heights. If you have existing table view code that behaves differently when you build your app with the iOS 11 SDK, and you don’t want to adopt self-sizing, you can restore the previous behavior by disabling estimated heights by setting a value of zero for each estimated height property. (30197915)
(8)当UITableViewCell的内容(主要是文本)高度过高时,可以通过设置UITableViewCell的numberOfLines属性来实现类似于UILabel一样的高度自适应变化
When the user selects one of the Accessibility Larger Text content sizes as their preferred content size, UITableViewCell uses a new default layout that is optimized for the larger sizes. The numberOfLines property of UITableViewCell labels (both textLabel and detailTextLabel) changes to 0 (unlimited) by default when the Accessibility content sizes are in use. You may override this by explicitly setting the numberOfLines property. The standard image view and accessory views are aligned with the first line of text in the cell, and cell text wraps around the image in order to maximize the amount of text displayed per line. For the Value1, Value2, and Subtitle styles, the detailTextLabel is arranged underneath the standard textLabel. For UISwitch accessory views, the switch is located below the labels and aligned with the leading edge of the text. Because of these changes, which increase the height of the cell content at Accessibility content sizes, it’s important to use self-sizing cells to ensure the row height increases as necessary, and to avoid using a fixed row height for all content sizes. (28102750)
以上就是笔者挑选了大部分与开发有一定关系的更新翻译,其他的一些比如iCloundKit,Apple Music等国内使用率较少的更新笔者就没有翻译了,后期笔者将会用代码进一步深入研究iOS11的新功能带来的美妙体验,敬请期待!
更多推荐
所有评论(0)