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(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正式退出历史舞台
原文:Using 3D Touch with data detectors (phone numbers, addresses, etc.) does not work. (30504832)
这里比较多,对开发而言意义不大,我就捡几条重点的说了
(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)
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.
• 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)
• 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)
Storing data to a non default event store in EventKit may not work. (31335830)
主要更新在网络请求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)
UIKit框架
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的新功能带来的美妙体验,敬请期待!