organize your notes with iOS 10-compatible datasource text: Http://www.jianshu.com/p/0cc7aad638d91.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 HTTP network in IOS 9 is deprecated, 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 above Value values, circled the red line part of the text is displayed to the user to see, need to add their own specification instructions, can not be empty. 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.
14.Xcode 8 warning issue with Xib awakefromnib
(This article was updated at: 2016-09-18)
It Xcode 8 Xib - (void)awakeFromNib {} 's OK to write this before we use initialization, but Xcode 8 there's a warning like this:
If you don't like the warning, you should definitely add [super awakeFromNib]; us to the official note:
Must call the super implementation of awakefromnib to give, parent classes the opportunity to perform any additional in Itialization they require. Although the default implementation of this method does nothing, many UIKit classes provide NON-EMPTY implementations. The super implementation at any point during your own awakefromnib method.
15.Xcode 8 issues with slow compilation
(This article was updated at: 2016-09-20)
Many people are Xcode 8 not reflected before the compilation is fast, even some people slow spicy eyes. But I do not feel very slow, as before, I think there should be some connection with the computer, some developers do not restart the computer for several months, the computer running a bunch of threads, a bunch of useless garbage. Here is the method of accelerating the Xcode compilation, interested can go to see:
Improve Xcode compilation speed
16.iOS imagepickercontroller.cameraviewtransform problem
(This article was updated at: 2016-09-21)
Many people reflect the custom camera has a problem, cameraViewTransform can not be used, in fact, the online information about this is not a lot, here provide the following methods:
- By listening
AVCaptureSessionDidStartRunningNotification to solve
//#import <AVFoundation/AVFoundation.h> //monitoring [[nsnotificationcenter Defaultcenter] addobserver:self selector:< Span class= "Hljs-keyword" > @selector (cameranotification:) name: Avcapturesessiondidstartrunningnotification object:nil]; //Monitoring Method-(void) Cameranotification: ( nsnotification *) notification {dispatch_async (Dispatch_ Get_main_queue (), ^{//here to achieve Imagepickercontrollercgaffinetransformmaketranslation (50, 50); }); }
- Working with
AVFoundation Frames
It UIImagePickerController doesn't seem to apply iOS 10 . So you can choose AVFoundation to solve this problem.
Here is the reference study:
Uiimagepickercontroller ' s Cameraviewtransform
iOS development adaptation iOS10 and Xcode8 source text: HTTP://WWW.JIANSHU.COM/P/9756992A35CA
Now on Apple's official website, we can already download to Xcode8 's GM version, plus 9.14 early morning, Apple will formally launch IOS10 system push, on this occasion, iOS10 adaptation is imminent, do not know Xcode8 beat version, Children's shoes have wood to download come and try it? As far as my use is concerned, the overall impression is that Apple is still in the pit, but it has been improving. Let me just say that the iOS10 and the Xcode8 use some points of attention.
First, certificate management
After opening the project with Xcode8, it is obvious that this is a new feature of Apple that can help us manage certificates automatically. We recommend that you check this automatically manage signing(Ps.) but in the BEAT2 version I use, completely can not, GM version unexpectedly fantastic and good. )
qq20160913-8.png-96.9kb
Let me tell you about the problems that may arise:
1.Xcode without a developer account set
qq20160913-0.png-38.5kb
The solution is: everyone in the Xcode preferences, add an Apple account, you can.
2. The device machine is not added to the developer's device.
qq20160913-2.png-33.7kb
The solution is: everyone in the official website to add the device into the development machine, accompany the description file to re-next description file.
3. Normal situation: Xcode Configure the image after login to the developer account, wait patiently.
qq20160913-1.png-25.1kb
Diagram after waiting for completion
QQ20160913-3.PNG-27KB Ii. notes on xib documents
After you use Xcode8 to open the Xib file, a prompt appears.
qq20160913-9.png-41.7kb
You can choose Choose Device.
Then everyone will find the layout ah, frame chaos, only need to update frame. Such as
qq20160913-11.png-113.2kb
- Note: If you follow the above steps and open xib with Xcode7, the error will be reported.
qq20160913-12.png-32.3kb
Third, code and API note
After using Xcode8, some of the code may not be compiled, specifically I would like to talk about the problems I encountered.
Proxy method for 1.UIWebView:
* * Note to delete Nserror in front of the nullable, otherwise error.
- (void)webView:(UIWebView *)webView didFailLoadWithError:(nullable NSError *)error{ [self hideHud];}
Iv. Workarounds for code annotations not available
This is because Apple solves Xcode ghost and blocks the plugin.
Workaround
Open terminal, command run: sudo/usr/libexec/xpccachectl
Then you have to restart the computer to take effect
Note: The Xcode8 has a built-in annotation feature, where
Qq20160914-3.png
The shortcut keys are set here
Qq20160914-2.png
Seemingly Xcode8 canceled the function of the three-party plug-in, specific can refer to the next Xcode8 Source Editor
V. Permissions and Related Settings
Note that when added, there is no space at the end
We need to open the Info.plist file to add a description of the appropriate permissions, or the program will crash on IOS10.
Specific example:
Qq20160914-0.png
Microphone Permissions: Privacy-microphone usage Description Do you want to allow this app to use your microphone?
Camera permissions: Privacy-camera usage Description Do you want to allow this app to use your camera?
Album Permissions: Privacy-photo library Usage Description Do you want to allow this app to access your media library? Address Book permissions: privacy-contacts Usage Description Do you want to allow this app to access your contacts?
Bluetooth permissions: Privacy-bluetooth Peripheral usage Description Do you Xu Yun this app to use Bluetooth?
Voice to text permissions: Privacy-speech recognition usage Description allow this app to use speech recognition?
Calendar permissions: Privacy-calendars usage Description Do you want to allow this app to use the calendar?
Location permissions: Privacy-location when on use Usage Description we need to get relevant data about you from your location
Location rights: Privacy-location always Usage Description We need to get data about you from your location
The positioning needs to be written so as to prevent the shelves from being rejected.
Six, the font becomes larger, the original frame needs to fit
After some friends remind, found that the original 2 words in the program width is 24, now 2 words need 27 width to show.
Hope to have a solution to the friend, comments sue me yes, thank you
Seven, push to send
such as the section, do not forget to open. All the push platform, whether it is the aurora or what, to receive the push, this must be opened yo??
Qq20160914-4.png
After that, you should be able to receive the push. In addition, the Aurora Push also launched a new version, you can also update.
PS. Apple has made a lot of changes to the push, I hope that we have more access to review, processing the agent method of push has changed.
// 推送的代理[<UNUserNotificationCenterDelegate>]
IOS10 receive notification is no longer handled in the
[application:didreceiveremotenotification:] method, IOS10 introduces a new proxy method, Receive and process various notifications (local or remote)
-(void) usernotificationcenter: (Unusernotificationcenter *) Center Willpresentnotification: (unnotification *) notification Withcompletionhandler: (void (^) ( unnotificationpresentationoptions)) Completionhandler {//app receives notification in foreground nslog (@ "========%@", notification);} -(void) Usernotificationcenter: (Unusernotificationcenter *) Center Didreceivenotificationresponse: (unnotificationresponse *) response Withcompletionhandler: (void (^) ()) Completionhandler {//Click notification to enter app nslog (@ "response:%@", Response)}
I will update the article later and give a detailed explanation of the push.
8. Screen for messy bugs
After updating the Xcode8, the newly created project will print a bunch of logs that are inexplicable to read.
such as these
0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1,
The shielding method is as follows:
Xcode8 inside Edit scheme-> Run--Arguments, in the environment variables inside add
Os_activity_mode = Disable
Qq20160914-8.png
If you have written or printed log, please check the checkmark again, you can solve the
IOS10 and XCODE8 related data collection