iOS SDK Release Notes for iOS 9 iOS9 SDK 版本更新说明

与世无争的帅哥 提交于 2020-01-18 06:38:39

Important:

This is a preliminary document for an API or technology in development. Apple is supplying this information to help you plan for the adoption of the technologies and programming interfaces described herein for use on Apple-branded products. This information is subject to change, and software implemented according to this document should be tested with final operating system software and final documentation. Newer versions of this document may be provided with future betas of the API or technology.

 

Contents:

Introduction

iOS SDK 9.0 provides support for developing iOS apps. It is packaged with a complete set of Xcode tools, compilers, and frameworks for creating apps for iOS and OS X. These tools include the Xcode IDE and the Instruments analysis tool, among many others.

With this software you can develop apps for iPhone, iPad, or iPod touch running iOS 9. You can also test your apps using the included Simulator, which supports iOS 9. iOS SDK 9.0 requires a Mac computer running OS X v10.10.3 (Yosemite) or later.

This version of iOS is intended for installation only on devices registered with the Apple Developer Program. Attempting to install this version of iOS in an unauthorized manner could put your device in an unusable state.

For more information and additional support resources, visit http://developer.apple.com/programs/ios/.

iOS9系统现在需要开发者账号注册的设备才能更新。如果没有授权强行安装,可能会出现不可控的问题。 

Bug Reporting

For issues not mentioned in the Notes and Known Issues section, please file bugs through the Apple Developer website (https://developer.apple.com/bug-reporting/ios/). Additionally, you may discuss these issues and iOS SDK 9.0 in the Apple Developer Forums. To get more information about iCloud for Developers, go to http://developer.apple.com/icloud.

Notes and Known Issues

The following issues relate to using iOS SDK 9.0 to develop code.

App Store

Note

iOS 9 enforces the UILaunchImages requirement; apps can no longer declare the same launch image to support different interface orientations.

iOS9强制使用UILaunchImages, App不再需要为不同的屏幕方向指定同一张启动图。

Known Issue

Users might be prompted twice for credentials on the first In-App Purchase.

第一次使用程序内购买的时候,用户可能需要俩次身份验证。

Apple ID

Notes

  • Some users will be offered to turn on two-factor authentication on their Apple ID. For more information about two-factor authentication see developer.apple.com/support/two-factor-authentication.
  • If you turn on two-factor authentication on your Apple ID, iTunes purchases on Mac and Windows and store purchases on Apple TV will require you to append a six-digit verification code to the end of your password the first time you use that device. The six-digit code will display automatically on your iOS 9 or OS X El Capitan devices, or can be sent to your trusted phone number via a text message or phone call.

在使用AppleID时,一些用户可能需要二次授权。如果你开启了双重认证, 当你在mac系统或windows系统或者Apple TV中购买产品时,如果是第一次在这个设备上使用,会要求提供一个六位的安全码, 这个安全码会显示在你的iOS9系统或者OS X El Capitan系统设备上,或者以信息方式发送到你的手机或者一个语音电话。

Apple Pay

Note

The format of the postal code that is returned prior to full authorization has changed from iOS 8. In some cases, it may be truncated from what was previously being returned.

完全授权时使用的postal code从iOS8系统开始发生改变。 在一些情况下会比之前的缩短。

AVFoundation

Notes

  • The canUseNetworkResourcesForLiveStreamingWhilePaused property has been added to AVPlayerItem. The default value is NO for apps linked on or after iOS 9.0 or OS X 10.11, but YES for apps that were linked earlier.To minimize power usage, set this property to NO if you do not need playback state to stay up to date while paused.
    新属性canUseNetworkResourcesForLiveStreamingWhilePaused, iOS9系统以前默认开启,iOS9默认关闭,如果需要减少性能消耗,在视频流暂停的时候,如果不需要使用播放状态可以把这个属性设为关闭。

  • AVQueuePlayer now supports a mixture of file-based media and HTTP Live Streaming media in its queue. Prior to this, you had to ensure that all items in the queue were of the same type.
  • AVQueuePlayer 现在支持基于本地文件和网络流媒体的视频流,所以,你必须保证队列中所有的内容是同一种类型。
  • For apps linked against iOS 9 or later, the media interruption behavior for AV(Queue)Player has changed.Before iOS 9, apps could interrupt other media-playing clients by associating or adding AVPlayerItem to AVPlayer or by modifying the time or date of the current AVPlayerItem (using the seekToTime: or seekToDate: methods). In iOS 9, these operations interrupt only when AVPlayer object’s playback rate is changed to a non-zero value through the rate property or play method.


    iOS9以后,AVPlayer和AVQueuePlayer 的中断行为发生变化, iOS9以前,App在使用AVPlayerItemAVPlayer时,或者修改AVPlayerItem的播放时间,会打断其他正在播放的客户端,在iOS9系统,这些操作只有在rate值非0的时候才会打断 (rate是正常播放和快速播放的频率,在暂停的时候rate值为0), 或者在调用play函数的时候打断。
    大概意思是说,以前其他软件正在播放,进入当前软件,一调用相关函数,正在播放的软件就会停止, 现在不会了, 只有在当前软件正在播放或者开始播放的时候,才会打断之前的软件。

  • Picture in Picture playback might stop and the Picture in Picture button might disappear when using AVPlayerViewController for video playback and replacing the underlying AVPlayer object’s current item using replaceCurrentItemWithPlayerItem:.

在使用AVPlayerViewController播放视频并且使用replaceCurrentItemWithPlayerItem方法,替换当前AVPlayer的播放视频对象时,画中画功能可能会停止并且画中画按钮会消失。

 

  • The cancelPictureInPicture method is deprecated.    取消画中画函数过时,不再建议使用。

Bluetooth

Known Issue

Pairing a Miura MFI accessory to an iOS 9 device will not work.      Miura认证的蓝牙功能在iOS9系统不再支持。

Workaround: Do not remove pairing after updating to iOS 9.       提醒: 在升级iOS9之后,不要移除配对。

CBCentralManager

Note

The retrievePeripherals: and retrieveConnectedPeripherals methods were deprecated in iOS 7.0 and removed in iOS 9.0. Apps that use these methods will crash on launch or upon pairing an accessory.

retrievePeripherals  retrieveConnectedPeripherals  方法在iOS7系统过时,现在在iOS9系统禁止使用,App如果使用这俩个函数会崩溃。

Foundation

Notes

   省电模式下提供新的Api函数。

 Whenever possible, batch and reduce network operations, and avoid unnecessary updates to the user interface. Power-intensive operations should be under the user’s control. If a user is playing a graphics-heavy game, for example, the user should not be surprised if the activity consumes power. Strive to make your app absolutely idle when it is not responding to user input.

 

在省电模式下,尽可能减少网络请求,避免不必要的界面刷新,消耗电量的操作应该由用户主动发起。如果用户正在玩大型游戏时,不应该让用户对电量的消耗感到太惊讶,尽量保证让用户不再操作时,App是完全空闲状态。

 省电模式链接:https://developer.apple.com/library/prerelease/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/index.html#//apple_ref/doc/uid/TP40015243

 

  • Horizontal location constraints should consistently reference either left/right or leading/trailing attributes. For apps linked against the iOS 9 SDK, NSLayoutConstraint will throw an exception if you attempt to create a constraint between a leading/trailing attribute and a left/right attribute.

水平坐标布局,需要遵循左右和前后对齐属性。 在iOS9里面, 如果你试图创建的布局会导致左右和前后对齐方式冲突,NSLayoutConstraint会抛出异常。

iCloud Drive

Note

The fetchAllChanges property on CKFetchRecordChangesOperation has been deprecated, and will be removed in iOS 9.

CKFetchRecordChangesOperation 的fetchAllChanges属性过时,iOS9系统禁止使用。

Keyboards

Note

The setting to use a third-party keyboard as the default keyboard for text input is not always respected.

默认使用第三方键盘(百度、搜狗等)的设置,不会一直遵守。

Keychain

Note

iCloud Keychain will not sync passwords and credit cards with betas of iOS 9 and OS X El Capitan.

iOS9和OS X El Capitan,系统不会同步密码和银行卡。

Music

Note

When users plug in headphones or connect to Bluetooth or CarPlay in their car, their favorite music app appears on the lock screen or the car display.

 当你连上耳机、蓝牙或者车载播放器时,最喜欢的音乐会显示在手机屏幕或者车载播放器屏幕上。

For your app to be eligible for this, it must publish to Now Playing upon launch and consistently maintain a Now Playing state. A common practice upon launch is to continue playing the track from when the app was last exited.

如果想要你的App支持这个功能,App必须设计成启动时播放,并且可以一直保持播放状态。一个简单的做法是,当App是最后一个关闭的音乐播放App时,仍然可以继续控制播放音乐。

Known Issue

Some tracks you have previously purchased won’t play.        

提示: 你之前购买的一些音乐不会播放。

Workaround: Sign out of the Store and then sign back in.    

方案:退出Store,然后再次登录。

Networking

Notes

  • When negotiating a TLS/SSL connection with Diffie-Hellman key exchange, iOS 9 requires a 1024-bit group or larger. These connections include:
    • Secure Web (HTTPS)
    • Enterprise Wi-Fi (802.1X)
    • Secure e-mail (IMAP, POP, SMTP)
    • Printing servers (IPPS)
  • DHE_RSA cipher suites are now disabled by defaults in Secure Transport for TLS clients. This may cause failure to connect to TLS servers that only support DHE_RSA cipher suites. Applications that explicitly enable cipher suites using SSLSetEnabledCiphers are not affected and will still use DHE_RSA cipher suites if explicitly enabled.Safari may see a “Safari can’t establish a secure connection to the server” error page. Safari and other clients of CFNetwork API (NSURLSessionNSURLConnectionCFHTTPStreamCFSocketStream and Cocoa equivalent) will show “CFNetwork SSLHandshake failed” error in Console.


    当使用Diffie-Hellman加密算法做TLS/SSL连接通信时,iOS9 系统要求1024位或者更大。 这些连接包括: 
    • Https Web通信
    • 企业WiFi 802.1x认证
    • 安全的邮箱认证 包括IMAP, POP, SMTP格式。
    • IPPS格式的打印服务

  • DHE_RSA加密方案在iOS9系统默认禁止用来做TLS客户端的安全通信, 这可能导致连接只支持DHE_RSA 加密算法方案的TLS服务器时连接失败。 App可以开启SSLSetEnabledCiphers, 然后可以仍然使用DHE_RSA加密方案。
    Safari浏览器可能会在错误页面上显示“Safari不能创建一个安全的通信连接”。Safari和其他类似的使用CFNetwork API(包括NSURLSessionNSURLConnectionCFHTTPStreamCFSocketStream and Cocoa equivalent)的客户端,会在控制台显示“ CFNetwork SSLHandshake failed” 出错信息。

On-Demand Resources

Known Issue

New or changed on-demand resource assets packs that are added or changed as part of an app update may be inaccessible to the application.

Workaround: Include the new or updated asset packs directly in the application bundle.

按需加载资源

 

提示:在App更新时,新增加或者修改的资源文件,可能会出现无法访问的情况。

解决方案:把新增加或修改的资源文件,直接放到App安装包。

 

ReplayKit

Known Issue

Playing a video while ReplayKit recording is ON stops the ongoing recording session and the video fails to play.

播放视频时,如果ReplayKit的录制开关是开启状态,会导致出现停止正在进行的录制进程,并且播放视频失败。

Restore

Known Issue

If you’ve set a region that doesn’t match your language, restores from iCloud Backup might not progress.  

     如果你设置了不符合你的系统语言的时区,iCloud备份还原可能不会运行。

Workaround: During restore, change your region to match your language. You can change it back after the restore is over.

  提示: 在还原时,把你的时区改成跟你的系统语言一致,你可以在还原成功后再改回来。

Safari

Notes

  • When Done is tapped in a SFSafariViewController, it is automatically dismissed. You no longer need to dismiss it in the delegate method safariViewControllerDidFinish:.
  • “Find on Page” is now available both from the Share sheet as well as in the Completions List.
  • Request Desktop Site has moved; it’s now in the Share sheet instead of Favorites.
  • Web Browser–to–Native App Handoff does not work with your app if the apple-app-site-association file isn’t correctly formatted and signed. For more information, see Handoff Programming Guide and Shared Web Credentials Reference.

 

  • 当点击SFSafariViewController界面中的完成按钮时,网页窗口会自动关闭。你不需要再自己调用dismiss方法。
  • “在页面中查找” 功能现在可以在分享插件(Share sheet)和完成列表(Completions List)中,一样可以使用。
  • Request Desktop Site(本地主页)被移除,它现在放到“共享的链接”里面,而不是以前的“个人收藏”。
  • 网页版App的handoff同步功能, 如果App的相关文件不是正确的格式或者签名,handoff功能会不可用。

Use SFSafariViewController if your app lets users view websites from anywhere on the Internet. UseWKWebView if your app customizes, interacts with, or controls the display of web content.

iOS9新增 SFSafariViewController,可以在App中任何地方调用来浏览网站, 如果你想要定制网页显示内容,还是使用WKWebView。

 

 

Secure Transport

Note

DHE_RSA cipher suites are now disabled by default in Secure Transport for TLS clients. This may cause failure to connect to TLS servers that only support DHE_RSA cipher suites. Applications that explicitly enable cipher suites using SSLSetEnabledCiphers are not affected and will still use DHE_RSA cipher suites if explicitly enabled.

DHE_RSA密钥算法在TLS平台安全数据传输时默认禁用, 这可能导致只支持DHE_RSA密钥算法的TLS认证服务器连接失败。  App设置属性SSLSetEnabledCiphers开启时不受影响,可以继续使用DHE_RSA密钥算法。

UIKit

Notes

  • If initialized with a nil nibName value, UIViewController.nibName has always looked for a nib with a similar name as the view controller’s class, and defaulted to that value if loadView is not overridden.Prior to iOS 9, subclasses of UIViewController that were written in Swift would require that their corresponding nib file name include the module prefix.
    To improve flexibility in the event of refactoring, you can omit the module name from the nib filename in code that runs in iOS 9. UIViewController.nibName still prefers a name that contains the module prefix, but falls back to an unqualified name if a nib with the fully-qualified name is not found.
  • In iOS 9, when layoutIfNeeded is sent to a view and all of the following conditions are satisfied (which is not common), we apply fitting-size constraints (width/height = 0 at UILayoutPriorityFittingSizeLevel) instead of required size constraints (width/height required to match current size):
  1. The receiver is not yet in the subtree of a view that hosts a layout engine, such as window, view controller view (unless you have set translatesAutoresizingMaskIntoConstraints to NO on that view—or created constraints that have one item in its subtree and one item outside it), table view cell content view, and so on.
  2. The final ancestor (that is, top-level view) of the receiver has translatesAutoresizingMaskIntoConstraints set to NO.
  3. The top-level view has a subview that is not a UIViewController-owned layout guide that also has translatesAutoresizingMaskIntoConstraints set to NO.
  • Under condition 1, we create a temporary layout engine from the top-level view and add all the constraints from the subtree to it. The problem is that we need to add some constraints that make the size of the top-level view unambiguous in the layout engine. The old behavior (prior to iOS 9) was that we would add constraints to restrict the size of the top-level view to its current bounds for any situation under condition 1. This really doesn’t make sense when you add conditions 2 and 3 and can result in unsatisfiable-constraints logging and broken layout.So in iOS 9, for this special case only, we use fitting-size constraints instead.
    This means that if you are sending layoutIfNeeded to a view under these conditions in iOS 9, you must be sure that either you have sufficient constraints to establish a size for the top-level view (which usually, though not always, is the receiver) or you must add temporary size constraints to the top-level view of layout size you desire before sending layoutIfNeeded, and remove them afterward.
  • For apps linked on iOS 9 or later, UITextView will now always correctly constrict its NSTextContainer to the fit inside the view when scrolling is disabled. Overflowing lines that lie outside of an NSTextContainer, even partially, are not rendered.In previous iOS releases, the NSTextContainer sometimes was not constricted in size. This meant that logically overflowing lines were erroneously rendered. If you are seeing previously rendered lines at the end of your text view no longer rendered after linking your app against iOS 9, this behavior change is the likely cause. You can remedy this by making your UITextView larger, or perhaps by adjusting the bottom value of the text view's textContainerInset property.
  • There is a redesigned UI for printing that includes a print preview (presented from UIPrintInteractionController or UIActivityViewController). For apps that provide printing items or use only built-in UIPrintFormatter objects (such as UISimpleTextPrintFormatter,UIMarkupTextPrintFormatterUIWebViewPrintFormatter, or the UIViewPrintFormatter of any system-provided view), nothing additional is needed for the print preview to display.Apps that subclass UIPrintPageRenderer or UIPrintFormatter to draw content for printing must be built with the iOS 9 SDK for the preview to display. The behavior of UIPrintPageRenderer has been updated to call drawPageAtIndex:inRect: multiple times with potentially different page sizes and margins. Various methods on UIPrintPageRenderer may be called from a non-main thread, but never from multiple threads concurrently.
  • UIPickerView and UIDatePicker are now resizable and adaptive—previously, these views would enforce a default size even if you attempted to resize them. These views also now default to a width of 320 points on all devices, instead of to the device width on iPhone.Interfaces that rely on the old enforcement of the default size will likely look wrong when compiled for iOS 9. Any problems encountered can be resolved by fully constraining or sizing picker views to the desired size instead of relying on implicit behavior.


    如果初始化UIViewController时,传递的nibName属性是nil, 那么UIViewController的nibName属性会一直被锁住为跟当前Controller类一个名字的nib, 并且一直是这个值除非loadView方法被重写。在iOS9以前,使用Swift语言写的UIViewController的子类,会要求必须填写合适的nib文件名字。为了改善重构时自由度体验,你可以在iOS9中忽略写这个名字。UIViewController.nibName会优先寻找里面包含Controller类名前缀的,如果找不到完全符合名字的nib,会返回不合格的。
    在iOS9里面,当layoutIfNeeded方法在一个view对象调用时,并且下列所有的条件满足,我们使用fitting-size约束,而不是要求大小约束合格。
    1、接收者不是宿主view的子view,例如window,Controller的view(除非你在view创建时,把translatesAutoresizingMaskIntoConstraints 属性设置为NO,或者创建约束时有一个是子view,另一个是view外), tableview 、cell content view 等等。
    2、当前view层级的最后一个view,的属性translatesAutoresizingMaskIntoConstraints 设置为NO;
    3、最高层view有一个子view,并且不归controller控制布局,它的translatesAutoresizingMaskIntoConstraints 也设置为NO。


    对于条件1,我们对最高层view创建一个临时的layout约束,并且把所有子view的约束添加给它。 问题是我们需要添加一些约束,用来让最高层view的size明确起来。 iOS9以前,我们需要添加一些约束给最高层view来适应它当前的bounds来满足条件1。 当你增加条件2、3的约束时这会不起作用,导致不可控的约束进而破坏界面布局。
    所以在iOS9里面,对于这种特殊的情形,我们用fitting-size约束来代替。
    这意味着,在iOS9系统里面当你对一个满足上述条件的view调用layoutIfNeeded方法时,你必须确保,或者你已经对最高层view设置了size大小, 或者在调用方法前你必须对最高层view添加临时的size约束,并且随后移除size约束。

  • 对iOS9以后的App,UITextView  当滚动属性被禁用时,会始终修改它的NSTextContainer,来满足view中的显示内容。 溢出NSTextContainer的线,或者是一部分线,不会显示。
    在iOS9以前,NSTextContainer有时候不受size大小约束,这意思是说,溢出的线会错误的显示出来。如果你以前看到过溢出的线在textview底部显示了,但是现在不再显示,就是这个行为改变的。你可以补救这个问题,通过放大UITextView,或者可能是通过textContainerInset属性设置textview的底部边距。


    对打印功能来说,打印预览界面被重新设计, 对提供打印功能的App来说,或者是使用到UIPrintFormatter对象,不需要附加其他因素就可以显示预览界面。
    在App里,如果继承了UIPrintPageRenderer 或者 UIPrintFormatter类,必须使用iOS9的sdk来实现预览。 UIPrintPageRenderer 的行为,已经更改为使用drawPageAtIndex:inRect方法,对不同的界面大小和边缘会调用多次。更多相关UIPrintPageRenderer的方法会在非主线程被调用,但是不会同一时间在多个线程执行。


    UIPickerViewUIDatePicker 现在大小可调和自适应,以前如果你想修改它们,它们的视图会强制使用一个默认的大小。 现在它们的视图会在所有的设备类型上默认使用320宽度,而不是iPhone手机的设备宽度。
    当用iOS9编译时,依赖于默认大小的界面可能会出错。 任何因为这个修改导致的问题,可以通过完整的约束,或者修改picker view的尺寸来解决,而不是依赖于其他不明行为。
  • Webkit

    Note

    The if-domain and unless-domain value strings only match the exact domain. To match the domain and any subdomains, begin the string with the asterisk character (*).

     使用Webkit时,if-domain、unless-domain属性只支持完全匹配,如果想要符合所有的一级二级域名,用*号字符开头。

    标签
    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!