After the upgrade of Xcode8 and iOS10, the problems encountered in the development, now sort out my problem solving records.

After opening the push notification, I found two problems so far. They are big or small, but really annoying! Do not open this if there is no push related project!

This time the real machine test if the problem as shown below:

If you want to know Xcode8 development iOS10 push notification process Please click, author: zhao0 http://www.jianshu.com/p/133b535a4e90

1.2 After push notification is enabled, layout constraints are lost and views become blank in xiB files; At this time, we first Update the Frames. If it still doesn’t work, we need to re-add the overall view layout. First, add constraints from outside to inside.

## 2. Xcode8 prints a lot of irrelevant content

Just upgraded to Xcode8 and noticed that the console was printing a lot of stuff. For example :subsystem: com.apple.network, category:, enable_level: 0, persist_level: 0, default_TTL: 0, info_TTL: 0, debug_TTL: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0

Solution:

Of course Xcode8 is a lot of work at the moment, you know, if it doesn’t work sometimes, just re-check the check box ✅.

Xcode8 cannot print logs on the real machine

#ifdef DEBUG // The test is in development// Real machine print#define ZLString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define ZLLog(...) Printf ("%s line %d: %s\n\n", [ZLString UTF8String],__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);
#else // Publishing is in publishing phase
#define ZLLog(...)
#endif
Copy the code

With iOS10, the black lines removed from navi are back. So how do you go in and deal with it.

- (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; / / remove the black line on nav (the timing viewDidAppear) [self removeNavBlackLine: self. The navigationBar]; } - (void)removeNavBlackLine:(UIView *)view {for (UIView *subView in view.subviews) {
        if (subView.subviews.count) {
            [self removeNavBlackLine:subView];
        } else {
            
            if(subView.frame.size.height <= 1) { [subView removeFromSuperview]; }}}}Copy the code

If your nav doesn’t need a background color there’s certainly an easier way to do it.

// + (void)initialize {// Remove the black line on nav [UINavigationBar appearance]. ClipsToBounds = YES; }Copy the code

## 5. Remove the black lines on the TabBar and change the background

- (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // Remove black lines from tabBar (timing important!!) [self removeTabBarBlackLine:self.tabBar]; } - (void)removeTabBarBlackLine:(UIView *)view {for (UIView *subView in view.subviews) {
        if (subView.subviews.count) {
            [self removeTabBarBlackLine:subView];
        } else {
            
            if(subView. Frame. The size, height < = 1) {/ / if or remove the black thread when it enters the secondary pages back to level 1 page will display, so use hidden with respect to OK. SubView. Hidden = YES; }}}}Copy the code
+ (void)initialize {// UITabBar * tabBar = [UITabBar * tabBar = [UITabBar * tabBar  appearance]; tabbar.backgroundImage = [UIImage imageNamed:@"tabbar"];
}
Copy the code

If your Tabbar doesn’t need the middle button to stand out, there’s certainly an easier way. Otherwise the highlighted image will be flat cut off!!

/** * Initialize {// Remove the black line on tabbar [UITabBar appearance]. ClipsToBounds = YES; }Copy the code

Deep custom tabBar. Please click: author: the moon catch non-trace http://www.jianshu.com/p/dd3475fb3960

IOS10 is more stringent about privacy permissions. In the call camera, photo albums, positioning, bluetooth, etc., all need the info. Configured to add in the plist. Info. Plist NSContactsUsageDescription

## 7. ATS problem

  1. In iOS 9, HTTP networking is disabled by default and you can disable ATS with NSAllowsArbitraryLoads set to YES.
  2. As of January 1, 2017, all new apps submitted to iOS 10 will not be allowed to bypass the ATS restriction by default. This means that we are forced to use HTTPS. Otherwise, apps submitted may be rejected.
  3. However, we can optionally use NSExceptionDomains to whitelist HTTP approval for specific domains.
  4. The info in the iOS 10. New join NSAllowsArbitraryLoadsInWebContent key file, to allow any web page is loaded, ATS colleague apple will use to protect your App.
  5. SSLv3 is not supported for secure transmission. You are advised to disable THE SHA1 and 3DES algorithms as soon as possible.

*[[UIDevice currentDevice] systemVersion]*

[[[[UIDevice currentDevice] systemVersion] substringToIndex:1]integerValue: 10.000000 [[UIDevice currentDevice] systemVersion].floatValue, [[UIDevice currentDevice] systemVersion]Copy the code

IOS10 changes with the font on the phone

When the font of our mobile phone system is changed, the font will change with the mobile phone system. The label of our App may lead to the hidden and incomplete display of some text, which requires us to write a lot of codes to further deal with. But the iOS 10 adjustsFontForContentSizeCategory provides such attributes to set.

Solution: Write an extension class for UILabel

@implementation UILabel (Extend)
 
- (void)lableAdaptIOS10{
 
    CGFloat iOS10 = [[UIDevice currentDevice] systemVersion] >= 10.0;
    if(iOS10) {/ / self UIFont preferredFontForTextStyle: meaning is to specify a style, and make the font size in line with the user to set the font size. [self sizeToFit]; // self.font =[UIFont preferredFontForTextStyle: UIFontTextStyleHeadline]; / / / / whether to update the font change self. AdjustsFontForContentSizeCategory = YES; }Copy the code

Xcode8 does not show builds after submission if the build does not appear after a long time after submission. The reason is that iOS10 has to add Settings in info.plist to protect privacy, including location, camera, microphone, photo album, camera, etc. But after adding, remember to write!!!! in the following description Otherwise, the build is likely to fail. ➕ will not appear next to the build. Of course you don’t see it in the historical version. Almost no hint. When the next version was committed, 1.1.1 failed (see version 1.1.1 here).

Pay attention to the iOS 10 launch page

At this time, it is necessary to check whether the Image size is correct first, and then clear the Launch Screen File. Brand Assets will not be selected in Launch Image Sourc.

Xcode8 comment invalid

Open the terminal and run sudo /usr/libexec/xpccachectl to restart the PC

Want to learn more relevant compatible with iOS up 10 notes, please click, author: totally changed, http://www.jianshu.com/p/0cc7aad638d9 I feel this is quite good, thanks again ~ ~

Follow-up to sort out their own problems, to continue ~~