Organize your notes with iOS 10-compatible data

Source: Internet
Author: User
Tags uikit

Turn HTTP://WWW.JIANSHU.COM/P/0CC7AAD638D9

1.Notification (Notification)

Since Notification being introduced, Apple has been updating and optimizing, but these update optimizations are just a scratch, and until now iOS 10 is starting to really make big changes, which gives developers UserNotifications the ease of use and the ability to become very powerful.

    • Previous notifications for IOS 9

      1. When calling a method, some methods make it difficult to distinguish and write wrong methods, which makes the developer sometimes very distressed.

      2. The path that the app captures notifications at run time and non-runtime is not consistent.

      3. When applied to the foreground, remote notifications cannot be displayed directly, and further processing is required.

      4. Notifications that have been issued cannot be updated, the content is not changed when it is issued, and only simple text presentation, extensibility is not very good at all.

    • Notifications starting with IOS 10

      1. All relevant notifications have been consolidated into the UserNotifications.framework framework.

      2. Added cancellation, update, mid-way can also modify the content of the notice.

      3. The notification is not a simple text, you can add videos, pictures, custom notification display and so on.

      4.iOS 10 is easier to manage than previous notifications and has been optimized for large scale, which is a good thing for developers.

      5.iOS 10 starting with the optimization of permissions issues, it is easier to request permissions (local and remote notifications are integrated in one method).

    • IOS 10 Notification Learning Related Materials:

      Usernotifications: Apple Official document-Apple official Video 1-Apple official video 2-Apple official video 3
      Long-lived refactoring-IOS ten usernotifications Framework parsing
      WWDC2016 Session Notes-new features for IOS 10 push notification

2.ATS problem

The default non-HTTs network in IOS 9 is banned, and of course we can NSAllowsArbitraryLoads set it to YES disabled ATS . However iOS 10 since January 1, 2017 Apple does not allow us to skip through this method ATS , that is, forcing us HTTPS to use, if not, submitting the app may be rejected. But we can NSExceptionDomains easily pass audits by being open to specific domain names HTTP .

Reference study articles are as follows:
Questions about ATS in IOS 10

3.iOS 10 Privacy Rights settings

IOS 10 starts to be more strict with privacy rights, if you do not set it will crash directly, now a lot of crash problems, the general solution is to info.plist add the corresponding-on the file Key Value .


The 访问相册 addition of the Key wrong, correct is Privacy - Photo Library Usage Description .

The above Value values, circled the red line part of the text is displayed to the user to see, must be added. At present the solution is basically the same, the reference study article is as follows:
Compatible with iOS 10: Configure the Get Privacy Data permission statement

4.Xcode 8 Run a bunch of useless logs solutions

We see, a new project of our own to print a pile of rotten seven or eight bad things, I think this should be Xcode 8 the problem, specifically not detailed research, the solution is to set up OS_ACTIVITY_MODE : disable such as:


Related Issues Connection:
StackOverflow Quiz

5.iOS Uistatusbar Method Expires:

Some properties may be used in our development UIStatusBar , and these methods have expired in iOS 10 and need to be adapted if they are useful in your project. The above image can also be found if you need to use this example in iOS 10 preferredStatusBar :

//iOS 10 - (UIStatusBarStyle)preferredStatusBarStyle {    return UIStatusBarStyleDefault;}
6.iOS Uicollectionview Performance Optimization

With the trust of the developers, there are UICollectionView more places in the project, but there are still some problems, such as sometimes lag, slow loading, etc. So iOS 10 for UICollectionView further optimization, because the narrative is more complex time-consuming, here only to provide learning reference articles as follows:
WWDC2016 Session Notes-IOS Uicollectionview new features

7.iOS Uicolor New method

The following is an explanation of the official documentation:

Most graphics frameworks throughout the system, including core graphics, core Image, Metal, and avfoundation, with Substan Tially improved support for Extended-range pixel formats and wide-gamut color spaces. By extending this behavior throughout the entire graphics stack, it's easier than ever to support devices with a wide col or display. In addition, UIKit standardizes-working in a new extended sRGB color space, making it easy-to-mix sRGB colors with Colo RS in other, wider color gamuts without a significant performance penalty.

Here is some best practices to adopt as a start working with Wide Color.

  • In IOS, the Uicolor class uses the extended SRGB color space and its initializers no longer clamp raw component values To between 0.0 and 1.0. If your app relies on UIKit to clamp component values (whether "re creating a color or asking a color for its component values), you need to the change your app's behavior when you link against IOS 10.
  • When performing custom drawing in a UIView on an iPad Pro (9.7 inch), the underlying drawing environment is configured wit H an extended SRGB color space.
  • If your app renders custom image objects, use the new Uigraphicsimagerenderer class to control whether the destination bit Map is created using a extended-range or standard-range format.
  • If you is performing your own image processing on wide-gamut devices using a lower level API, such as Core Graphics or Me Tal, you should use an extended range color space and a pixel format that supports 16-bit floating-point component values. When clamping of color values are necessary, you should does so explicitly.
  • Core Graphics, Core Image, and Metal performance Shaders provide new options for easily converting colors and images Betwe En color spaces.

Because before we are used RGB to set the color, anyway, it is not particularly diversified, this new method should be a fix it. So in iOS 10 Apple is officially advised sRGB to use it because it has better performance and richer colors. If you have UIColor written a set of categories you can also try to replace sRGB , the UIColor class has added two new Api as follows:

+ (UIColor *)colorWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);- (UIColor *)initWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);
8.iOS Uitextcontenttype
// The textContentType property is to provide the keyboard with extra information about the semantic intent of the text document.@property(nonatomic,copy) UITextContentType textContentType NS_AVAILABLE_IOS(10_0); // default is nil

In iOS UITextField textContentType , an enumeration is added that indicates the semantic meaning desired by the text input area.

Use this property to give keyboard and system information about the intended semantic meaning of the content that the user enters. For example, you can specify a text field that the user fills in to receive an e-mail acknowledgment uitextcontenttypeemailaddress . When you provide information about what you expect users to enter in the text input area, the system can automatically select the appropriate keyboard in some cases and improve keyboard corrections and integration with other text input opportunities.

9.iOS 10 fonts change with the font of your phone system

When our phone system font changes, then our App 's label also changes, which requires us to write a lot of code for further processing to be implemented, but iOS 10 provides such properties Adjustsfontforcontentsizecategory to set. Because there is no real machine, the actual operation has not been realized, if you understand the wrong to help correct.

 uilabel *mylabel = [UILabel new]; /* uifont preferredfontfortextstyle: Meaning to specify a style and let the font size match the font size set by the user. */Mylabel.font =[uifont Preferredfontfortextstyle: uifonttextstyleheadline]; /* indicates whether the corresponding element should automatically update its font when the de Vice ' s uicontentsizecategory is changed. For the effect, the element's font must be a font vended using +preferredfontfortextstyle:or +preferred FontForTextStyle:compatibleWithTraitCollection:with a valid Uifonttextstyle. *///whether to update the font changes Mylabel.adjustsfontforcontentsizecategory = yes;           
10.iOS Uiscrollview New Refreshcontrol

IOS 10 supports refresh functionality as long as it is inherited UIScrollView :

@property (nonatomic, strong, nullable) UIRefreshControl *refreshControl NS_AVAILABLE_IOS(10_0) __TVOS_PROHIBITED;
11.iOS 10 Judging system version correct posture

Judging the system version is what we often use, especially now everyone may need to adapt to iOS 10, then the problem arises, such as:


We got the answer:

//值为 1[[[[UIDevice currentDevice] systemVersion] substringToIndex:1] integerValue]//值为10.000000[[UIDevice currentDevice] systemVersion].floatValue,//值为10.0[[UIDevice currentDevice] systemVersion]

Therefore, the best way to judge the system is to use the latter two methods, oh ~ I forgot to say that [[UIDevice currentDevice] systemVersion].floatValue this method is also not reliable, as if the value of the 8.3 version output is 8.2 , remember that is not clear anyway is not reliable, so we recommend that you use [[UIDevice currentDevice] systemVersion] this method!

Swift judges the following:

  if #available(iOS 10.0, *) {            // iOS 10.0            print("iOS 10.0"); } else { }

Reference articles are as follows:
Common macro definitions for daily work in IOS

12.Xcode 8 Plugin Not available problem

Everyone has upgraded Xcode 8 , but for developers who rely on plugins, they are crying and looking for solutions online. So here's the workaround:
Let your Xcode8 continue to use the plugin

But see the article at the end of the explanation, we know that if the use of plug-ins, there may be security problems, and the submission of the audit will be rejected, so it is recommended that you do not use, the solution is always there, such as the Xcode code block to add comments in is also very convenient.

13.iOS 10 Start Project Some text display is not complete problem

I used Xcode 8 and Xcode 7.3 separately tested the next, such as:


Xcode 8
Xcode 7

Create a Label and then let it adaptive size, the font size is the 17 final output width is not the same, we look at the following data to know why after the upgrade iOS 10 App of the text display is not complete:

Xcode 8 Printing Xcode 7.3 Printing
1 Text width: 17.5 1 Text width: 17
2 Text width: 35 2 Text width: 34
3 Text width: 52 3 Text width: 51
4 Text width: 69.5 4 Text width: 68
5 Text Width: 87 5 Text width: 85
6 Text width: 104 6 Text width: 102
7 Text width: 121.5 7 Text width: 119
8 Text width: 139 8 Text width: 136
9 Text width: 156 9 Text width: 153
10 Text width: 173.5 10 Text width: 170

The English alphabet will also have this problem, I passed the test, and later found that the English alphabet is not a problem, only the Chinese characters have problems. There is currently only one modification control to solve this problem, there is no other good way to solve it.

This article only for the collation of iOS 10 related materials, but also refer to some of the online articles, but also to update other iOS 10 related materials, as well as problems encountered in the development and so on.

IOS 10 Apple Official documentation



text/The person who is a person, (Jane book author)
Original link: http://www.jianshu.com/p/0cc7aad638d9
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".

Organize your notes with iOS 10-compatible data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.