This article is mainly about the iOS8.0 system to iOS14 system change difference, the blogger step pit course

Ios8.01, UIActionSheet and UIAlertView update

In iOS8, there’s officially a new class UIAlertController to replace UIActionSheet and UIAlertView.

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@”My Alert” message:@”This is an alert.” preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@”OK” style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { }]; [self presentViewController:alert animated:YES completion:nil]; 2. Change the use of positioning function

If ([CLLocationManager locationServicesEnabled]) {locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; [locationManager startUpdatingLocation]; }else {// the user can’t locate the operation} if you use this method in iOS8, you can’t locate the operation because of the new method in iOS8

// Indicates that positioning is enabled during application use

  • (void)requestWhenInUseAuthorization;

// Indicates that positioning is always enabled

  • (void)requestAlwaysAuthorization;

The difference is that since iOS7, have more powerful background, if use requestAlwaysAuthorization method, when the background is also using positioning

In iOS8, the system positioning is as follows:

If ([CLLocationManager locationServicesEnabled]) {locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self;

/ / compatible iOS8 positioning SEL requestSelector = NSSelectorFromString (@ "requestWhenInUseAuthorization"); if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined && [locationManager respondsToSelector:requestSelector]) { [locationManager requestWhenInUseAuthorization]; } else { [locationManager startUpdatingLocation]; }Copy the code

return YES; }else {// The user cannot locate the operation} return NO; In addition to this, you need to add new keys to info.plist, otherwise it will not be able to locate

Continued access to location NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription geographical position 3, when using solve their App in the jump to system Settings page

In iOS5.0 you can always jump to the system Settings page. But not after 5.1.

Here’s how iOS8 jumps. Here’s the code:

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url]; 1. Install untrusted developer apps

After Xcode7, developers can test with their iPhone instead of spending 99usd on a developer account. When you install these apps, iOS9 no longer prompts you with a trust button.

2, iOS9 network adaptation _ATS: switch to the more secure HTTPS

In order to enforce data access security, iOS9 will change all HTTP requests from NSURLConnection, CFURL, and NSURLSession to HTTPS requests by default: When ios9.x -SDK is compiled, all HTTP requests from NSURLConnection, CFURL, and NSURLSession use TLS 1.2 protocol by default. Since the current version of AFNetworking uses NSURLConnection, many apps will be affected (ios 8.x-SDK apps will not be affected). The server therefore needs to be updated to parse the relevant data. If you do not update, you can reverse the insecure network request by declaring it in info.plist.

The practice, officially documented as ATS, short for App Transport Security, is a new feature in iOS9.

NSAppTransportSecurity NSAllowsArbitraryLoads

3. BitCode configuration

BitCode is an intermediate form of app. There is a brief introduction to it in the first few iOS9 topics. For example, we can submit the BitCode form of app when submitting app, so that Apple will optimize our app twice, and then compile and package it according to the needs when users download it. In Xocde7, BitCode is enabled for new projects by default. If we compile and submit the application using Xcode7, there are some adaptions that need to be taken care of.

To support BitCode, you need to ensure that all SDKS support BitCode. If you want to update the old SDK, you just need to turn on BitCode on Xcode7 and re-create it.

If you can’t make all SDKS support BitCode, you can turn off BitCode in your project, search for BitCode in building Setting, and set enable to NO.

4. Whitelist of URL Scheme

In iOS9, apple introduced the concept of whitelisting, which has the benefit of enhancing in-app security. In iOS9 adaptation, if we use a method like canOpenURL, we need to configure a whitelist.

First, we create a test project that does nothing but add a URL Scheme

In another project, we write the following code:

BOOL can= [[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@”weixin://”]]; [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@”weixin://”]

In iOS8, apple has made some changes to the APP location service, requiring users to apply for corresponding permissions and add corresponding keys in the info.plist file

In iOS9 system, the practice of location service basically does not change, has no impact on the front positioning, but if the app needs background positioning, then it needs to do more operations, such as:

manager = [[CLLocationManager alloc]init]; / / application background location permissions [manager requestAlwaysAuthorization]; manager.delegate=self;

/ / this is a new method in iOS9 Open the background location manager. AllowsBackgroundLocationUpdates = YES; [manager startUpdatingLocation]; Running the program directly through the simple configuration above will crash the program and require some configuration in the plist file

1. IOS 10 Privacy permission Settings

Starting October 3, 2018, App Store Connect will require all new apps and App updates to provide a privacy policy before they can be submitted to the App Store or distributed through TestFlight external testing. In addition, you can edit the App’s privacy policy link or text only when you submit a new version of the App. For more information about adding a privacy policy link for apps distributed through TestFlight’s external tests, see the App Store Review Guide.

IOS 10 is going to be more strict with privacy permissions, and if you don’t set it, it will crash. Now many people get crashes, and the general solution is to add the corresponding key-value to the info.plist file.

Permission to name the Key value directory NSContactsUsageDescription microphone NSMicrophoneUsageDescription albums NSPhotoLibraryUsageDescription camera NSCameraUsageDescription add images to the photo album NSPhotoLibraryAddUsageDescription continued access to location NSLocationAlwaysUsageDescription access when using geographic location Turn words NSSpeechRecognitionUsageDescription NSLocationWhenInUseUsageDescription bluetooth NSBluetoothPeripheralUsageDescription voice Calendar NSCalendarsUsageDescription

2. ATS problems

Non-htts networks are disabled by default in iOS 9, but NSAllowsArbitraryLoads can also be set to YES to disable ATS. However, as of January 1, 2017, Apple will not allow us to skip ATS using this method, which means forcing us to use HTTPS, otherwise submitting apps may be rejected. But we can use NSExceptionDomains to open HTTP to specific domains and make it easy to approve.

3. Notification

All the relevant notice is unified to UserNotifications. The frame of the framework

Added contents of revocation, update and notification that can be modified in the middle

Notifications are no longer simple text. You can add videos, images, custom notifications, and more.

IOS 10 is much easier to manage than previous notifications and has been massively optimized, which is a good thing for developers

IOS 10 is starting to optimize permissions, making it easier to apply for permissions (local and remote notifications are integrated in one method).

4, iOS 10 UICollectionView performance optimization

With the developers’ trust in UICollectionView, the project uses more places, but there are still some problems, such as sometimes stuck, slow loading, etc.. So iOS 10 is further optimized for UICollectionView.

UICollectionView cell pre-loading mechanism

UICollectionView and UITableView prefetchDataSource new API

Improvements to Self-sizing cells

5, UITextContentType

TextContentType enumeration was added in iOS 10 UITextField to indicate the expected semantic meaning of the text input area.

Use this property to give the keyboard and system information about the expected semantic meaning of what the user has entered. For example, you can specify a text field, users fill out receive an email confirmation uitextcontenttypeemailaddress. When you provide information about what you expect the user to type in the text entry area, the system can automatically select the appropriate keyboard in some cases and improve keyboard correction and active integration with other text entry opportunities.

6. Fonts change with mobile system fonts

When we phone system font changed after that our App label will follow change together, this requires us to write a lot of code to further processing can be achieved, but the iOS 10 adjustsFontForContentSizeCategory provides such attributes to set. Because there is no real machine, the specific actual operation has not been realized, if you understand the error to help correct.

UILabel myLabel = [UILabel new]; / UIFont preferredFontForTextStyle: meaning is to specify a style, and make the font size in line with the user to set the font size. * /

myLabel.font =[UIFont preferredFontForTextStyle: UIFontTextStyleHeadline]; 

/* Indicates whether the corresponding element should automatically update its font when the device’s UIContentSizeCategory is changed. For this property to take effect, The element ‘s the font must be a font vended using + preferredFontForTextStyle: or +preferredFontForTextStyle:compatibleWithTraitCollection: with a valid UIFontTextStyle. */

/ / update the font changes where. AdjustsFontForContentSizeCategory = YES; 7. The system version judgment method is invalid

Our previous version of the system was as follows

When you go to iOS10.0, 9.0 and 10.0 will be in descending order instead of ascending order, which will cause iOS10.0 to be the earliest version, so that the iOS10 methods that are going to go later may not work

#define IOS9_OR_LATER ([[UIDevice currentDevice] systemVersion] compare:@”9.0″]! = NSOrderedAscending)

#define IOS8_OR_LATER ([[UIDevice currentDevice] systemVersion] compare:@”8.0″]! = NSOrderedAscending)

#define IOS7_OR_LATER ([[UIDevice currentDevice] systemVersion] compare:@”7.0″]! = NSOrderedAscending)

#define IOS6_OR_LATER ([[UIDevice currentDevice] systemVersion] compare:@”6.0″]! = NSOrderedAscending) it will always return NO,substringToIndex:1 will be detected as iOS 1 on iOS 10,

#define isiOS10 ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue]>=10)

The correct opening should be:

#define IOS10_OR_LATER ([[UIDevice currentDevice] systemVersion] floatValue] >= 10.0)

#define IOS9_OR_LATER ([[UIDevice currentDevice] systemVersion] floatValue] >= 9.0)

#define IOS8_OR_LATER ([[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)

#define IOS7_OR_LATER ([[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)

#define IOS6_OR_LATER ([[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) 8, Xcode8 Debug Output irrelevant information

When we upgraded to Xcode8, the console output a very long message when we debug, which is very annoying. How to shield it?

You need the Edit Scheme to add a key-value pair.

OS_ACTIVITY_MODE value: disable was added

9. App jump Settings

  openUrl:

  openURL: options: completionHandler:

Prefs :root= a service

To jump to system Settings, add a prefs value to the URL type, as shown below:

10. Judging version method

[[UIDevice currentDevice] systemVersion] 11. Push xcode adaptation switch

Turn on the Push Notifications option in the Targets Capabiliies

Then Background Modes turn on the following options

In the General import UserNotifications framework

Xib file

(1) Open xiB file with Xcode8, the prompt “Choose an Initial Device View” will appear. Choose the blue “Choose Device view” directly.

(2) If the layout is out of order, Update the xiB in the lower right corner, i.e. Update Frame.

Code and API

(1) UIView proxy method may display error, delete nullable before NSError.

(2) The UIStatusBar method is out of date. If statusBar is set in the project, write as follows:

  • (UIStatusBarStyle)preferredStatusBarStyle { 

return UIStatusBarStyleDefault; } 4. IOS 11.0 1. XCode9 running access system album crash

Symptom: The function of saving pictures as shown crashes when running in XCode9

Cause: Info.plist added permission configuration

Add a new permission to info.plist:

Privacy-photo Library Additions Usage Description 2. Location information cannot be obtained, and the location permission prompt box cannot be displayed when opening the APP for the first time

IOS11 location permissions have been changed and a new location permission key has been used on iOS11

Solution:

If the original application permissions are always allowed to NSLocationAlwaysUsageDescription, Need to retain the original on the basis of key increase NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUsageDescription.

Continued access to location NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription geographical position 3, when using wireless real machine test

This is WWDC2017’s new feature, iOS11 above, Xcode9 this is rigid requirements; But the speed is really not very dry compliment. Note that the mobile phone and computer must be on the same LAN

IOS11UI adaptation more, such as the start figure, tabbar, bangs, navigation bar, start figure adaptation of these UI adaptation later updated

1. Check whether it is iPhone X method in the code

The way many people used to determine whether a phone was an iPhone X was based on its size. Because the bangs need special treatment. That may not work now.

You can use other methods, such as StatusBar or bottom safe distance

#define rmStatusBarH ([UIApplication sharedApplication].statusBarFrame.size.height)//(44/20)

#define KIsiPhoneX ((rmStatusBarH == 44.0)? YES : NO)

Can also:

#define isIPhoneXSeries ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? ( CGSizeEqualToSize(CGSizeMake(375, 812),[UIScreen mainScreen].bounds.size) || CGSizeEqualToSize(CGSizeMake(414, 896),[UIScreen mainScreen].bounds. Size)) : NO

If you use Cocoapods to reference third-party libraries in your project, you may fail to compile after upgrading.

Because I didn’t use Cocoapods in my project, I didn’t come across it. I checked the information online, probably because:

IOS 12 removed libstdc++ and replaced it with libc++ :

Multiple info.plists cause crashes.

Excess info.plist can be deleted

Recommended scheme:

Xcode->File->Project Settings-> Build System -> Legacy Build System.

Multiple Commands produce ‘XXX/info.plist’

Error: Multiple Commands produce ‘XXX/info.plist’ in Xcode 10

Solution:

(1) Standard scheme: delete all duplicate named files.

(2) Provisional Scheme:

Xcode menu bar File -> Workspace Settings -> Build System -> Legacy Build System;

Xcodeprj Project: Xcode menu bar File -> Project Settings -> Build System -> Legacy Build System.

IOS 12 WiFi failed to obtain the SSID(WiFi name) and BSSID(MAC address)

After iOS 12, Apple increased access control for WiFi names and MAC addresses. To access these information, you need to manually enable access to WiFi information for your app.

Solution:

In the developer account, check the Access WiFi Infomation option of the App ID of the project;

In Xcode’s Capabilities, check the Access WiFi Infomation option for your project.

5. In Xcode 10, #import does not flash or import header files

Xcode will flash back in Xcode 10 when #import is entered to import file/library headers. Or type #import to import the header without prompting.

Solution:

Xcode menu bar File -> Workspace Settings -> Build System -> Legacy Build System;

Xcodeprj Project: Xcode menu bar File -> Project Settings -> Build System -> Legacy Build System.

6. The status bar disappears after the webView returns from playing the video

The UIStatusBar is still hidden when the main window becomes the KeyWindow after the video is played.

Solution:

  • (void)videoPlayerFinishedToShowStatusBar

{if (@ the available (iOS 12.0, *)) { [[NSNotificationCenter defaultCenter] addObserverForName:UIWindowDidBecomeKeyNotification object:self.window queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) { [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; }]; }} 7, Xcode 10 imageNamed: can not load Assets image properly

ImageNamed: Load the image in Assets and it comes out nil, just put the image in the bundle.

1. Private KVC

IOS does not allow valueForKey and setValue: forKey to obtain and set private attributes

Such as:

[textField setValue:[UIColor red] forKeyPath:@”_placeholderLabel.textColor”];

/ / replace

textField.attributedPlaceholder = [[NSAttributedString alloc] InitWithString: @ “input” attributes: @ {NSForegroundColorAttributeName: [UIColor red]}]; 2, black line processing crash

Before, in order to deal with the black line problem in the search box, UISearchBarBackground will be deleted after traversal. In iOS13, UI rendering will fail to crash; The workaround is to set layer.contents of UISearchBarBackground to nil

public func clearBlackLine() { for view in self.subviews.last! .subviews { if view.isKind(of: NSClassFromString(“UISearchBarBackground”)!) { view.backgroundColor = UIColor.white view.layer.contents = nil break; }}} 3. Modal present

IOS13 mode jumps out of the screen, like the previous version is no longer full screen

If this attribute is set to UIModalPresentationAutomatic, then read this property will always return a specific presentation styles. By default, UIViewController will UIModalPresentationAutomatic resolved as UIModalPresentationPageSheet, But the system to provide a subclass of UIModalPresentationAutomatic can be resolved as other specific presentation styles. Keep UIModalPresentationAutomatic resolution for the use of the system to provide the view controller. Since iOS 13.0, default is UIModalPresentationAutomatic on iOS, the default for UIModalPresentationFullScreen in previous versions. In all other platforms, is UIModalPresentationFullScreen by default.

Is the following appearance UIModalPresentationPageSheet

Knowing the reason, we do adaptation is also simple, is to set the next property:

let second = SecondViewController() second.modalPresentationStyle = .fullScreen present(second, animated: True, completion: nil

When using dark mode in iOS13, the default background color of UIView will be dark. It is too much work to adapt to dark mode, so use normal mode instead.

Solution: Add the configuration item UIUserInterfaceStyle with a value of Light to the plist file.

5. Update bluetooth permission

Upload the App Store, if cited CoreBluetooth framework, you need to add a description configuration NSBluetoothAlwaysUsageDescription, otherwise unable to submit. Older versions of the Push SDK relied on CoreBluetooth when introduced, and subsequent versions have been modified to no longer rely on CoreBluetooth.

Solution: Check that other third-party libraries do not rely on CoreBluetooth.framework and remove references to this library.

Discard UIWebview and change it to WKWebView

There is no forced modification at the moment, but I have sent an email to remind you that you need to make a modification, otherwise it may not be able to be put on the shelves

7. KVC restriction

Error when modifying system API private properties using KVC on iOS13

*** Terminating app due to uncaught exception ‘NSGenericException’, reason: ‘Access to xxx’s _xxx ivar is prohibited. This is an application bug’

Treatment scheme:

1. Global search for the use of KVC did not find the code that used KVC to modify private attributes

2. Pay attention to the use of KVC during normal development

8, third-party login support Apple login (Sign In with Apple)

Apple has updated its approval guidelines to require all apps that exclusively use third-party logins to have Sign in with Apple by April 2020. Apps that meet the following conditions may not be accessed:

Use self-created account and login system;

Educational, corporate or business applications that require users to log in using an existing educational or business account;

Using government – or industry-supported citizenship identification systems or electronic IDS to authenticate users;

An app that is specific to a third-party service and requires users to use email, social media or other third-party accounts to access its content;

9. Use MJExtension to handle nULL differences

When the server data dictionary is converted to the model, if the data given by the server is NSNull,

Mj_JSONObject, where the class_copyPropertyList method gets an EFSQLBinding, and the number of properties is not accurate.

There’s nothing I can do about it,

I’m just going to have to rewrite this method, write a method swizzling without updating this component that will go straight to nil when it hits NSNull.

10, WKWebView to measure the height of page content changes

IOS 13 before

document.body.scrollHeight

IOS 13

document.documentElement.scrollHeight

The difference of 55 should be a change in browser definition height

11. Umu message push to obtain deviceToken adaptation

  • (void)application:(UIApplication*)applicationdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { if(! [deviceToken isKindOfClass:[NSData class]]) return; const unsigned *tokenBytes = (constunsigned *)[deviceToken bytes]; NSString *hexToken = [NSString stringWithFormat:@”%08x%08x%08x%08x%08x%08x%08x%08x”,ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),ntohl(tokenBytes[6]),ntohl(tokenBytes[7])]; pushDeviceToken = hexToken; NSLog(@”deviceToken:%@”,hexToken);

} 12. Obtain the Wi-Fi name

IOS12 before

id info = nil; NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); for (NSString *ifnam in ifs) { info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam); NSString *str = info[@”SSID”]; //name} TARGET–>Capabilities enable Access WiFi Information in Xcode

After iOS 13, the fixed value “WLAN” is returned when the wi-fi name is obtained by the above methods. This may be caused by Apple’s protection of user privacy, because the user’s geographical location can be located through wifi information. So after iOS13, if you want to continue to obtain the WiFi name, you need to determine whether the user agrees with the App to use geographic location information before calling the interface. User permissions can be requested at startup with the following method:

#import <CoreLocation/CoreLocation.h>

@property (strong, nonatomic) CLLocationManager *locationManager;

NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];

CGFloat version = [phoneVersion floatValue];

/ / if it is iOS13 not open location permissions Need to prompt the if ([CLLocationManager authorizationStatus] = = kCLAuthorizationStatusNotDetermined && version >= 13) { self.locationManager = [[CLLocationManager alloc] init]; [self.locationManager requestWhenInUseAuthorization]; } If the user refuses the authorization, add a prompt in the interface for obtaining wi-fi name:

NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];

CGFloat version = [phoneVersion floatValue];

/ / if open location permissions not open need to prompt the if (([CLLocationManager authorizationStatus] = = kCLAuthorizationStatusNotDetermined ||[CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted ||[CLLocationManager authorizationStatus] = = kCLAuthorizationStatusDenied) && version 13) > = {[PracticalTools showAlertViewWithTitle: @ “prompt message:” @ “your location permissions has not been authorized, Will not be able to get the current configurations of wi-fi networks, please go to “Settings” – “* * * * App” – “position” for authorization! “doneText: @” determine “cancelText: nildoneHandle: nil cancelHandle: nil vc: self]. } 13, iOS13 correctly obtain Devicetoken

#include <arpa/inet.h>

  • (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

if (! [deviceToken isKindOfClass:[NSData class]]) return;

 const unsigned *tokenBytes = (const unsigned *)[deviceToken bytes];

NSString *hexToken = [NSString stringWithFormat:@”%08x%08x%08x%08x%08x%08x%08x%08x”, ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]), ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]), ntohl(tokenBytes[6]), ntohl(tokenBytes[7])]; NSLog(@”deviceToken:%@”,hexToken); } 14. The project created by Xcode 11 runs with a black screen on earlier versions of devices

For a project created using Xcode 11, a black screen will appear when you run the application on a device with iOS 13.0 or lower. This is because by default Xcode 11 will create an application that manages multiple UIWindows through UIScene, adding a SceneDelegate in addition to the AppDelegate.

Ios-xcode11: Remove default main. storyBoard, custom UIWindow can’t be handled in AppDelegate, add SceneDelegate agent

This is for multi-process iPadOS, which means UIWindow is no longer managed in UIApplication. But older versions don’t have UIScene at all, so the solution is to add the following to the AppDelegate header:

@property (strong, nonatomic) UIWindow *window;

NSAttributedString optimization

For UILabel, UITextField, and UITextView, you should also consider adapting Dark Mode when setting NSAttributedString. Otherwise, it will merge with background color when switching Mode, resulting in bad experience

Not recommended

NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:16]};

NSAttributedString * STR = [[NSAttributedString alloc] initWithString:@” Rich Text Copy “Attributes :dic]; Recommended practices

/ / add a NSForegroundColorAttributeName attribute NSDictionary * dic = @ {NSFontAttributeName: [UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor labelColor]};

NSAttributedString * STR = [[NSAttributedString alloc] initWithString:@” Rich Text Copy “Attributes :dic]; Seven, iOS 14.0 1, Liu Haibing statusBarFrame. The size, height change

Before the bangs came out, the height of the status bar at the top of the iOS App was 20pt, the height of the layable area in the navigation bar was 44pt, the height of the whole navigation bar was 64pt, and the safety distance at the bottom was 0. After the bang-screen phone comes out, the height of the status bar at the top of the iOS App of the Bang-screen model is 44pt, the height of the layout area of the navigation bar is 44pt, the height of the whole navigation bar is 88pt, and the safe distance at the bottom is 34pt. Swift:

/ / get the height of the status bar, full screen mobile phone in the status bar height is 44 pt, a comprehensive screen mobile phone status bar height of 20 pt / / status bar height let statusBarHeight = UIApplication. Shared. StatusBarFrame. Height; // let navigationHeight = (statusBarHeight + 44) // Let tabbar height = (statusBarHeight==44? 83: 49) // Let topSafeAreaHeight = (statusbarheight-20) BottomSafeAreaHeight = (tabbarheight-49) OC same principle as above

double statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 2. Controls on UITableViewCell do not respond to click events

UITableViewCell in iOS14 if a child control is added to the cell it’s going to be obscured by the cell’s contentView, which is going to be on top.

Workaround: Add child controls to the contentView or hide the Cell’s contentView

[self.contentView addSubview:self.showLabel]; [self.contentView addSubview:self.btn]; 3. UICollectionView scrollToItemAtIndexPath is invalid.

UICollectionViewLayoutAttributes *layoutAttributes = [self.collectView.collectionViewLayout layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]]; [self.collectView setContentOffset:layoutAttributes.frame.origin animated:YES]; UIPickerView/UIDatePicker

(1) iOS14 UIPickerView subviews only 2 elements, forced access will cause a crash; Refer to BBS developer.apple.com/forums/thre…

[pickerView.subviews[1] setHidden:YES]; [pickerView.subviews[2] setHidden:YES]; (2) after iOS13.4, UIDatePicker modified the default display style, if you want to use the previous style can add the following Settings

If (@ the available (iOS 13.4, *)) {_datePickerView. PreferredDatePickerStyle = UIDatePickerStyleWheels; } else {// Fallback on earlier versions

Itms-90809: Deprecated API Usage – Applications using UIWebView will no longer be updated in December 2020. Instead, use WKWebView for increased security and reliability

Basically, I can see this thing every time I go online. Recently, I heard that an App launched by the group has been rejected because of this UIWebView. Check the source code to see if there is a UIWebView or UIWebViewDelegate in the search box. Through the Mach – O to comprehensive search otool – oV path] [Mach – O | tee [test results log file name] log

Otool – oV/Users/a58 / Desktop/Tools/XXX. | app/XXX tee classInfo. Log interpretation otool – oV] [Mach – O path is to obtain all the class structures and their defined methods | tee Classinfo. log Because there are too many printed things, we can not display them in the terminal, you can put the printed things in the terminal file

Just query UIWebView in dot log

Using this method, you can find uiWebViews in the relevant tripartite library and UIWebViews in the relevant. A framework, and then upgrade and replace them

6. Xcode12 is very slow, it seems to have this problem if it is directly updated to Xcode12 on Xcode11, please refer to the link address of this article, if it still doesn’t work, you can try to uninstall Xcode and reinstall it completely, I will not be stuck after re-installation

— — — — — — — —

Copyright notice: This article is originally published BY CSDN blogger “MinggeQingchun”, in accordance with CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement. The original link: blog.csdn.net/MinggeQingc…