詳細見參考鏈接吧, 其他不多說了. 適配iOS11&iPhoneX的一些坑 http://www.cocoachina.com/ios/20170921/20623.html http://www.jianshu.com/p/26fc39135c34 http://www.jianshu.com/p ...
前言
-
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)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
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)
- 1
- 2
- 3
- 4
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的新功能帶來的美妙體驗,敬請期待!
詳細見參考鏈接吧, 其他不多說了.
適配iOS11&iPhoneX的一些坑
http://www.cocoachina.com/ios/20170921/20623.html
http://www.jianshu.com/p/26fc39135c34
http://www.jianshu.com/p/efbc8619d56b
http://www.jianshu.com/p/efbc8619d56b
http://www.jianshu.com/p/efbc8619d56b
http://blog.csdn.net/keep_moving31038/article/details/77685591
http://blog.csdn.net/u013263917/article/details/72895728