IOS 13 is officially out, and the web is full of descriptions of new features in the user experience. Another aspect of development that needs to be looked at is what changes the new system makes at the API level, and how that affects our existing code.
Here, we have done some sorting based on iOS 13 Release Notes, mainly to list some new apis provided by Apple and which ones are deprecated
General
• iOS 13 UIApplicationExitsOnSuspend no longer supported. Applications need to be updated to handle modern multitasking.
UIKit
• The UITableViewCell class does not change the backgroundColor or Opaque properties of the contentView and any of its child views when a cell is highlighted or selected. If you want to set an opaque backgroundColor on any child view of the content inside (including) the contentView, the appearance of the cell when highlighted or selected may be affected. The easiest way to fix any problems with subviews is to make sure backgroundColor is set to nil or clearColor, and their Opaque property is set to false. However, if desired, you can override the setHighlighted: Animated: and setSelected: Animated: methods to manually change these properties on the subview when moving to the highlighted state and selected state.
, starting from the iOS 8, UISearchController use needs to be top view controller with UINavigationController definesPresentationContext attribute set to true. Failure to do so can result in subtle errors that are difficult to detect and debug. Starting with iOS & iPadOS 13 Beta, if the navigationItem of the view controller has a non-nil search control, when the view controller is displayed in the navigation controller, UINavigationController will automatically the view controller definesPresentationContext attribute set to true. If you want to locate earlier versions of iOS, set this property before the search controller becomes active.
• The UIRefreshControl class no longer directly modifies its scroll view’s contentInset. Instead, its adjustments to content insertion are merged into adjustContentInset for scrollview. The only exception is when the scroll view contentInsetAdjustmentBehavior set to UIScrollViewContentInsetAdjustmentNever, in this case, UIRefreshControl instance will modify the contentInset directly as in previous versions.
• If self-adjusting cells are implemented in UITableView by overwriting sizeThatFits without using automatic layout, the returned height will be interpreted as the height required by the cell’s contentView, UITableViewCell automatically adds any other height separators needed to make room for the cell. If manual self-resizing is implemented in this way, the cell’s contentView width can be guaranteed to be accurate for use in manual layout calculations when calling sizeThatFits: on the UITableViewCell.
Trait environments (such as views and view controllers) now populate traitCollection properties with traits during initialization. These initial characteristics represent a prediction of the final characteristics that the feature environment will receive when added to the hierarchy. Because the features that are populated during initialization are only a prediction, they may differ from the features that are actually received in the hierarchy. Therefore, whenever possible, you should wait to perform work using traitCollection until the view or view controller’s view moves into the hierarchy — meaning that the window returns a non-zero value — so that you don’t have to discard any work and do it with predicted features if the actual features are different. The best time to use traitCollection is during layout, such as inside layoutSubviews, viewWillLayoutSubviews, or viewDidLayoutSubviews.
Only when the change characteristic value, can call traitCollectionDidChange: method. Importantly, due to the characteristics of collection now initialized to target hierarchy the characteristics of the forecast, when the initial forecast characteristics and the hierarchy of the final match, characteristics of the environment is added to the hierarchy will not be called traitCollectionDidChange:. Because traitCollectionDidChange: To as invalid callback to inform you that one or more features have been changed, please review the existing implementations of this method, as well as the method of UIContentContainer willTransitionToTraitCollection: withTransitionCoordinator:, Trigger the initial setup where you might depend on it. The best place to do lazy work with traitCollection is one of the layoutSubviews methods discussed above, but keep in mind that these layout methods will be called at any time the layout is called, so be sure to avoid reworking when you don’t need to.
, you can now enable debug logging, in order to call on your own class traitCollectionDidChange: or willTransitionToTraitCollection: withTransitionCoordinator:. Use the following launch parameters open log records: – UITraitCollectionChangeLoggingEnabled YES. You might want to temporarily disable the main thread checker when you use this startup parameter and run the application from Xcode to avoid adding additional log messages for unrelated classes.
• The contentView property of the UITableViewCell class is always side to side with adjacent attachments in front and behind. This simplifies layout code, so developers who want the correct default offset no longer need to align their content with the content-view border or layout margin, depending on whether there is an attachment at the end. You should now always place code on the layout margin of the cell content view to get the default system insert. These inserts are automatically adjusted based on the attachments visible in the cell to match the system’s default spacing.
• You can now call a custom initializer from creating a block, The create block by instantiateInitialViewController (creator:) or instantiateViewController (identifier: creator:). This allows you to initialize view controllers with additional contexts and parameters while defining them in the storyboard via Interface Builder. The custom controller initializer must call its super.init(coder:) method and pass the encoder parameters it receives through the creation block.
network
• To enhance security, NSURLSession no longer sniffs for MIME types when the server sends Content-Type:application/octet-stream.
• NSURLRequestReloadRevalidatingCacheData and NSURLRequestReloadIgnoringLocalAndRemoteCacheData API is now available.
• Enforce copy of the HTTPBodyStream property of NSMutableURLRequest as of iOS 13 Beta 4. If the body data is modified after the property setter is called, the data sent in the HTTP request will not contain the change. The getter that calls that property no longer returns an NSMutableData reference, even if the setter is called with data of that type. As of iOS 13 Beta 5, applications built using the iOS 12 SDK or previous SDK use the old version behavior.
• ** The information returned by the CNCopyCurrentNetworkInfo API does not reflect the actual situation. ** Please refer to the updated API documentation and title for more details.
, contains the body of a GET HTTP method of all instances NSURLSessionTask now will throw an error NSURLErrorDataLengthExceedsMaximum.
• Removed support for FTP and file URL schemes for proxy Autoconfiguration (PAC). HTTP and HTTPS are the only URL schemes supported by PAC. This affects all PAC configurations, including but not limited to the use of Settings, System preferences, “Profile” and NSURLSession API (such as connectionProxyDictionary and CFNetworkExecuteProxyAutoConfigurationURL) configuration Settings.
• NSURLSession and NSURLConnection APIS no longer support SPDY. The server should use HTTP 2 or HTTP 1.1.
audio
• Voice processing mode can now be enabled on AVAudioEngine.
• New AVAudioNode types can be used to wrap user-defined blocks to send or receive data in real time.
• AvAudioEngine-based applications can use a new method to retrieve a list of all nodes attached to an AVAudioEngine instance.
• The new rendering mode in AVAudioEnvironmentNode automatically selects the best spatial audio rendering algorithm based on the output device.
• A new AVAudioSession property allows system sound and tactile playback while the session actively uses audio input.
• new enumeration AVAudioSessionPromptStyle according to other audio activity in the system application should play what kind of voice prompt notice.
• AVAudioSessionRouteSharingPolicy now allow the application to specify the routing sharing strategy, so that the audio and video routing to the same location as the AirPlay.
• The Audio Unit Extensions now support user presets available in all host applications.
• The OpenAL framework has been deprecated, temporarily retained for compatibility purposes. Transition to AVAudioEngine for 3D audio capabilities.
• AUGraph has been deprecated in favor of AVAudioEngine.
• In-app audio is not recommended. Use Audio Units to support this functionality.
• The use of carbon-based Audio Units is not recommended and will not be supported in future versions.
• Old Core Audio HAL Audio hardware plugins are no longer supported. Use the audio server plug-in to support the audio driver.
Audio sharing
• Audio sharing is compatible with AirPods (1st generation or higher) and PowerBeats Pro. IPhone 8 or later is required.
AVFoundation
• AVFoundation now supports encoding video using HEVC and Alpha channels. Video encoded in this way is widely supported in the AVFoundation API and Safari in web pages. The technical details of the format can be found in the interoperability profile specification.
Core Image
• filterWithImageURL: options: with filterWithImageData: options: no longer support RAW 5 and earlier versions. Version 6 and later are still supported.
• Added new APIS for instantiating and modifying built-in Core Image filters.
• Enhanced CICoreL model filter to support models with input or output of type MLFeature Array.
• Metal CIKernel instances support parameters with arbitrary structured data.
• Metal CIKernel instances support returning a set of 2×2 pixels.
• The integral value of the CIFormat symbol (for example, kCIFormatARGB8) has been changed to a new set of values that are cross-platform consistent. The previous values still support backward compatibility; However, you should avoid dependencies on specific values.
• Ignore Blocked Senders can now be enabled in Settings > Mail. Blocked contact lists are shared with Messages, FaceTime, and Phone.
summary
From a development perspective, the biggest highlight of iOS 13 is undoubtedly the introduction of SwiftUI, which is also a highlight of WWDC 2019. In fact, the Release Note also talked a lot about SwiftUI. Since SwiftUI is still in the optimization stage, there are still many variables, so we will not explain them here. For details, please check the iOS 13 Release Note.
Also, since Apple started releasing beta versions of iOS 13.1 before the official release of iOS 13, some of the content may no longer be applicable. We’ll take a closer look at iOS 13.1 when it comes out.
The original link
More good articles, please pay attention to the public number of knowledge small set (ID: zsxjtip)