Content statement

Naked use of the content of this article to do the so-called original, trouble points face.

Xcode11 missing library file import location change

Libstdc-6.0.9 File download

This directory no longer exists under Xcode11

/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Run Times/iOS simruntime/Contents/Resources/RuntimeRoot/usr/lib / [to] /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Run times/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/Copy the code

The location below —- does not need to be changed

/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/ /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/ /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/us r/lib/Copy the code

Their Allies related Upgrade the latest SDK

[verification: only appears on simulator]

This should be the need for weibo official adaptation, trying to simulate getUniqueStrByUUID in the relevant writing method.

  • A temporary solution:
// Fix crash in iOS13 as: emulator#if TARGET_IPHONE_SIMULATOR// Static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{if(@available(iOS 13.0, *)){Method origin = class_getClassMethod([UIDevice class], NSSelectorFromString(@"getUniqueStrByUUID")); // IMP originImp = method_getImplementation(origin); Method swizz = class_getClassMethod([self class], @selector(swizz_getUniqueStrByUUID)); // Implement method_exchangeImplementations(Origin, swizz); }});#pragma mark - Get unique identifier for Sina+ (NSString *)swizz_getUniqueStrByUUID{ CFUUIDRef uuidObj = CFUUIDCreate(nil); //create a new UUID //get the string representation of the UUID NSString *uuidString = (__bridge_transfer NSString *)CFUUIDCreateString(nil, uuidObj); CFRelease(uuidObj);return uuidString ;
}
#endif
Copy the code
+[_LSDefaults sharedInstance] crash problem

Mobile statistics: 6.0.5 Message push: 3.2.4 Social sharing: 6.9.6

  • A temporary solution:
@implementation NSObject (Extend)
+ (void)load{
    
    SEL originalSelector = @selector(doesNotRecognizeSelector:);
    SEL swizzledSelector = @selector(sw_doesNotRecognizeSelector:);
    
    Method originalMethod = class_getClassMethod(self, originalSelector);
    Method swizzledMethod = class_getClassMethod(self, swizzledSelector);
    
    if(class_addMethod(self, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))){
        class_replaceMethod(self, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
    }else{ method_exchangeImplementations(originalMethod, swizzledMethod); }} + (void) sw_doesNotRecognizeSelector aSelector: (SEL) {/ / processing _LSDefaults collapse problemif([[self description] isEqualToString:@"_LSDefaults"] && (aSelector = = @ the selector (sharedInstance))) {/ / cold treatment...return;
    }
    [self sw_doesNotRecognizeSelector:aSelector];
}

Copy the code

DeviceToken accessTheir Allies announcement

#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);
}
Copy the code

UITextField

Modify blank message color by KVC mode crash
[UITextField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel. TextColor"];Copy the code
  • Solution:
attributedPlaceholder
Copy the code
LeftView and rightView Settings are abnormal

When setting the left button of leftView, if you use UIImageView, the image will not display as intended.

The subview of UITextField’s rightView will cause the rightView to cover the entire UITextField if it uses a constrained layout.

// Confuse in beta4 iOS13
UIImageView *imageIcon = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 34, 30)];
//search_icon  15*15
imageIcon.image = [UIImage imageNamed:@"search_icon"];
imageIcon.contentMode = UIViewContentModeCenter;
UITextField *txtSearch = [[UITextField alloc] init];
txtSearch.leftView = imageIcon;
Copy the code
  • Solution:UIImageVIew wraps a layer of UIView and then sets it to a leftView, sets it to a leftView, or rightView without using constraint layouts

UISearchBar

The searchTextField property is now exposed and no longer needs to be obtained through KVC.

UISearchBar *searchBar = [[UISearchBar alloc]init];
searchBar.searchTextField
Copy the code

Controller correlation

Modal jump style changes

The cutscene context mechanism has been tweaked to default to card style.

/*
 Defines the presentation style that will be used for this view controller when it is presented modally. Set this property on the view controller to be presented, not the presenter.
 If this property has been set to UIModalPresentationAutomatic, reading it will always return a concrete presentation style. By default UIViewController resolves UIModalPresentationAutomatic to UIModalPresentationPageSheet, but other system-provided view controllers may resolve UIModalPresentationAutomatic to other concrete presentation styles.
 Defaults to UIModalPresentationAutomatic on iOS starting inIOS 13.0, and UIModalPresentationFullScreen on previous versions. Defaults to UIModalPresentationFullScreen on all other Ffffice. */ @property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle API_AVAILABLE(ios(3.2)); [navsetModalPresentationStyle:UIModalPresentationFullScreen];
Copy the code
Mode landscape eject

If you want the modal view to pop up in landscape mode, be aware that it is affected by the jump style. The default card style will still pop up in portrait.

Refer to the link

- (BOOL)shouldAutorotate {
    return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
       return UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
        return UIInterfaceOrientationLandscapeRight;
}

Copy the code

Dark Mode color theme related

UIColor adaptation
UIColor * dynamicColor = [UIColor colorWithDynamicProvider: ^ UIColor * _Nonnull (UITraitCollection * provider) {/ / use Provider judgment, sometimes a problem occursif(keyWindow.isDark){
        return darkColor;
    }
    return lightColor;
 }];
Copy the code
YYTextView && YYLabel adaptationThe prerequisite for a perfect solution is that UIColor must be properly adapted

Transformation of YY — direct link

If you are doing the same, you are likely to encounter the following problems. After many attempts, the biggest problem was UIColor. However, the problem appears to be highly related to YY’s internal drawing task when Runloop is about to hibernate. The specific reason is still uncertain, and we’ll dig into it later.

Representation of native controls

Here first look at the system UILabel night adaptation for inspiration

UILabel
drawTextInRext
CTRunDraw()
UIDynamicProviderColor

. However, while the above scheme may work when YYLabel is applied, YYTeView has other problems. . Found in screening, sometimes UITraitCollection currentTraitCollection parsing out the color, and the corresponding state. . It turns out that the state of the colorWithDynamicProvider callback may be inconsistent with the current system state, which means that the callback is a little less reliable… Miss my youth

YYLabel adaptation

Yylabel. m Add the following code

#pragma mark - DarkMode Adapater

#ifdef __IPHONE_13_0
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection{
    [super traitCollectionDidChange:previousTraitCollection];
    
    if(@ the available (iOS 13.0, *)) {if([UITraitCollection.currentTraitCollection hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]){
            [self.layer setNeedsDisplay]; }}else {
        // Fallback on earlier versions
    }
}
#endif
Copy the code
YYTextView adaptation

Yytextview. m Add the following code

#pragma mark - Dark mode Adapter

#ifdef __IPHONE_13_0
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection{
    [super traitCollectionDidChange:previousTraitCollection];
    
    if(@ the available (iOS 13.0, *)) {if([UITraitCollection.currentTraitCollection hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]){ [self _commitUpdate]; }}else {
        // Fallback on earlier versions
    }
}
#endif
Copy the code

Something extra to do

  • NSAttributedString+ yytext. m removes some CGColor calls
- (void)setColor:(UIColor *)color {
    [self setColor:color range:NSMakeRange(0, self.length)];
}

- (void)setStrokeColor:(UIColor *)strokeColor {
    [self setStrokeColor:strokeColor range:NSMakeRange(0, self.length)];
}

- (void)setStrikethroughColor:(UIColor *)strikethroughColor {
    [self setStrikethroughColor:strikethroughColor range:NSMakeRange(0, self.length)];
}

- (void)setUnderlineColor:(UIColor *)underlineColor {
    [self setUnderlineColor:underlineColor range:NSMakeRange(0, self.length)];
}

Copy the code

UIImageView

Two main problems were found:

1. Initialization: UIImageView.image must be set during initialization; otherwise, it will not be displayed.

2. Dark adaptation: After stretching, dark adaptation will fail.

  • @Uninhibited Mimi Sheep share the solution:
#pragma mark - Solves Image stretching problems+ (UITraitCollection *)lightTrait API_AVAILABLE(ios(13.0)) {static UITraitCollection *trait = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ trait = [UITraitCollection traitCollectionWithTraitsFromCollections:@[ [UITraitCollection traitCollectionWithDisplayScale:UIScreen.mainScreen.scale], [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleLight] ]]; });returntrait; } + (UITraitCollection *)darkTrait API_AVAILABLE(ios(13.0)) {static UITraitCollection *trait = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ trait = [UITraitCollection traitCollectionWithTraitsFromCollections:@[ [UITraitCollection traitCollectionWithDisplayScale:UIScreen.mainScreen.scale], [UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark] ]]; });returntrait; } + (void)fixResizableImage API_AVAILABLE(ios(13.0)) {Class klass = uiimage.class; SEL selector = @selector(resizableImageWithCapInsets:resizingMode:); Method method = class_getInstanceMethod(klass, selector);if (method == NULL) {
        return;
    }
    
    IMP originalImp = class_getMethodImplementation(klass, selector);
    if(! originalImp) {return; } IMP dynamicColorCompatibleImp = imp_implementationWithBlock(^UIImage *(UIImage *_self, UIEdgeInsets insets, UIImageResizingMode resizingMode) {/ / in theory can be judged whether UIColor UIDynamicCatalogColor. Class, if not, the direct return to the original implementation; UITraitCollection *lightTrait = [self lightTrait]; UITraitCollection *darkTrait = [self darkTrait]; UIImage *resizable = ((UIImage * (*)(UIImage *, SEL, UIEdgeInsets, UIImageResizingMode)) originalImp)(_self, selector, insets, resizingMode); UIImage *resizableInLight = [_self.imageAsset imageWithTraitCollection:lightTrait]; UIImage *resizableInDark = [_self.imageAsset imageWithTraitCollection:darkTrait];if (resizableInLight) {
                [resizable.imageAsset registerImage:((UIImage * (*)(UIImage *, SEL, UIEdgeInsets, UIImageResizingMode))
                                                         originalImp)(resizableInLight, selector, insets, resizingMode)
                                withTraitCollection:lightTrait];
            }
            if (resizableInDark) {
                [resizable.imageAsset registerImage:((UIImage * (*)(UIImage *, SEL, UIEdgeInsets, UIImageResizingMode))
                                                         originalImp)(resizableInDark, selector, insets, resizingMode)
                                withTraitCollection:darkTrait];
            }
            return resizable;
        });

    class_replaceMethod(klass, selector, dynamicColorCompatibleImp, method_getTypeEncoding(method));
}

Copy the code

Drawing exception [it is not confirmed whether it is new in iOS13]

UIImageView draw

Application scenario: Custom control to generate images, drawing API will be UIImage stretching UIImageResizingModeTile interference.

Impact: What you get is not what you see

/ / / common drawing code UIGraphicsBeginImageContextWithOptions (contentSize, YES, [[UIScreen mainScreen] scale]); Question API: / / / CGContextRef CTX = UIGraphicsGetCurrentContext (); /// [self.viewContent.layer renderInContext:ctx]; The following apis are recommended:  [self.viewContent drawViewHierarchyInRect:CGRectMake(0, 0, contentSize.width, contentSize.height) afterScreenUpdates:YES]; / / generated images UIImage * image = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext();Copy the code
Cut long figure

Some friends feedback on iOS13 long screenshot, can only capture the current screen. Reason: Due to the mixed use of constraints and absolute layouts, the UI Settings of screenshot code and layout code should be adjusted to be consistent.

  • Truncated graph code is everywhere, and the principle is setupUIView.sizeIs the actual contentsize.
UIImage* shotImage = nil; UITableView *scrollView = self.tableBase; // Temporary data CGPoint fltOriginOffset = ScrollView. contentOffset; CGRect rectOrigin = scrollView.frame; scrollView.contentOffset = CGPointZero; scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height); UIGraphicsBeginImageContextWithOptions(CGSizeMake(scrollView.contentSize.width, scrollView.contentSize.height), ScrollView. Opaque, 0.0); [scrollView.layer renderInContext:UIGraphicsGetCurrentContext()]; shotImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // State restoration scrollView.contentoffset = fltOriginOffset; scrollView.frame = rectOrigin;Copy the code

UIWindow changeIOS 13.3 has been fixed by Apple

In iOS13, YYTextView generated anywhere in the App will cause the global scrollsToTop back-up function to be invalid. Although it was eventually traced back to YYTextEffectWindow, a lot of new content was found throughout the investigation.

This is normal fallback function call logic, based on the overrides of system-specific private functions to identify where the problem is coming from.

-[UICollectionView scrollViewShouldScrollToTop:] -[UIScrollView _scrollToTopIfPossible:] () -[UIScrollView _scrollToTopFromTouchAtScreenLocation:resultHandler:] () -[UIWindow _scrollToTopViewsUnderScreenPointIfNecessary:resultHandler:]_block_invoke.796 () -[UIWindow _handleScrollToTopAtXPosition: resultHandler:] () / / here we can see there is a fresh UIStatusBarManager iOS13 additional classes, you can see the status bar, click event has been taken over by it. // As a matter of practice, this method can also be called normally in case of a problem, so it is the above call stack method. -[UIStatusBarManager _handleScrollToTopAtXPosition:] () -[UIStatusBarManager handleTapAction:] ()Copy the code

Thought is the coexistence of multiple UIScrollView scrollsToTop set problem, and UIScrollViewContentInsetAdjustmentNever set problem. It didn’t turn out to be… Finally along the UIScrollView subclass has been searching, found YYTextView which used YYTextEffectWindow also came into view…

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        if(! [UIApplication isAppExtension]) { one = [self new]; one.frame = (CGRect){.size = kScreenSize}; one.userInteractionEnabled = NO; // You can see that the window level is higher than the status bar, but several attempts to adjust the level failed. one.windowLevel = UIWindowLevelStatusBar + 1; // So, even if user interaction is turned off, it blocks status bar events, but has no effect on regular Window events...if(@available(iOS 13.0, *)) {// Confusing results... one.hidden = YES; }else{ one.hidden = NO; } / /foriOS 9: one.opaque = NO; one.backgroundColor = [UIColor clearColor]; one.layer.backgroundColor = [UIColor clearColor].CGColor; }});return one;
Copy the code

Add a subview on UIWindow using addSubview. Note that dark mode switching does not deliver state changes to the subview.

  • Solution:
Get diablo switching system notification (implementation), and then rewrite the child views to add to the UIWindow overrideUserInterfaceStyle for the correct state.Copy the code

The UIScrollView scroll bar is abnormal

Screen rotation may trigger the system to automatically modify the scroll bar. If no modification is required, disable this feature

#ifdef __IPHONE_13_0
   if(@ the available (iOS 13.0. *)) {self. AutomaticallyAdjustsScrollIndicatorInsets = NO; }#endif
Copy the code

Abnormal UICollectionView API

In iOS13, this API forces the cell to be centered, leaving the upper part blank. Presumably, there should be a blank at the bottom.

#pragma mark - Fixed iOS13 scroll down exception API
#ifdef __IPHONE_13_0- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition  animated:(BOOL)animated{ [super scrollToItemAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated]; // Repair the abnormal Cell scroll position in 13if(@available(iOS 13.0, *)) {// topif(self.contentOffset.y < 0){
          [self setContentOffset:CGPointZero];
          return; } / / at the bottomif(self.contentOffset.y > self.contentSize.height){
          [self setContentOffset:CGPointMake(0, self.contentSize.height)]; }}}#endif
Copy the code

UITableViewCell exception

[self addSubView: viewObjA]

[self.contentView addSubview:viewObjB]

The above two ways, when you have the need to fold. Setting self.clipsToBounds=YES may cause layout exceptions

  • Solution:
// Have other friends feedback, encountered the opposite situation. Self. clipsToBounds = YES; self.clipsToBounds = YES; Self.layer.maskstobounds = YES; self.layer.maskstobounds = YES; "Effective"Copy the code

Possible layout engine mechanism adjustment [to be confirmed]

During debugging, it was found that if the code flow is in such a state, it may cause constraint failure.

If you encounter weird problems, check whether constraints and absolute layout are mixed

[viewMain addSubView:viewA]; [viewMain addSubView:viewB]; // Update viewA constraints [self.imageBackground mas_updateConstraints:^(MASConstraintMaker *make) {make.top.mas_equalto (50);}]; // Update the constraint immediately [viewa.superview]setNeedsUpdateConstraints]; [viewA.superview updateConstraintsIfNeeded]; [viewA.superview layoutIfNeeded]; // Update container constraints [viewMain mas_updateConstraints:^(MASConstraintMaker *make) {make....}]; . Other processing logic.... [self.imageBackground mas_updateConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(100); }];Copy the code

WKWebView

Dark adaptation

Key points:

  1. Mode parameters are passed through UA
  2. The loading glitch occurred in the joint tuning
webView.opaque = false;
Copy the code
WebJavascriptBridge failure
To verify theCopy the code

Gestures impact

In iOS13, if you attach a drag gesture to a UITextView, you’ll see that if the touch lands on the UITextView it’s very easy to trigger the first responder. The actual effect can be compared to the performance of ios versions prior to 12.

!!!!!!!!! Note that these two items will not improve even if turned on!! gesture.cancelsTouchesInView = YES; gesture.delaysTouchesBegan = YES;Copy the code
  • Take a look at the relevant call stack

  • Solution: DoUITextViewInternal gestures add external dependencies
///UITextView override
#ifdef __IPHONE_13_0// Used to solve the problem of abnormal activation and editing status caused by the magnifying glass gesture in the dragging UITextView scenario in iOS13. -(void)addInteraction:(id<UIInteraction>)interaction{ [super addInteraction:interaction];if(! self.otherGestureRecognizer || self.otherGestureRecognizer.count == 0){return;
    }

    if([interaction isKindOfClass:NSClassFromString(@"UITextLoupeInteraction")]){
        UIGestureRecognizer *delayLoupeGesture = [self.gestureRecognizers objectWithBlock:^BOOL(UIGestureRecognizer *obj) {
            return [obj isKindOfClass:NSClassFromString(@"UIVariableDelayLoupeGesture")];
        }];
        if(delayLoupeGesture){
            
            [self.otherGestureRecognizer forEach:^(UIGestureRecognizer *obj) { [delayLoupeGesture requireGestureRecognizerToFail:obj]; }]; }}}#endif
Copy the code

IOS13 text box —In view of the YYTextView

Double cursor problem

Note: error in using the __IPHONE_13_0 macro, should use @available(iOS 13.0, *)

_updateSelectionView {... . }Copy the code

YYTextView made the past modification link direct

Causes of the problem:

  1. Mechanism of the change
  2. There are problems with the previous modification to solve sogou input method and system keyboard word interruption.
  • Mechanism change – Tried many times on the real machine and confirmed as follows: Under iOS13, as long as the relevant protocol of UITextInput is followed, the system will automatically derive UITextSelectionView series components during the text selection operation, which obviously conflicts with YY’s own YYTextSelectionView. (Here is a hidden egg)

  • The previous code change to YYTextView has arbitrarily commented out the following method:

if (notify) [_inputDelegate selectionWillChange:self];
if (notify) [_inputDelegate selectionDidChange:self];
Copy the code

– internal data disruption related to text selection, which is currently only visible in iOS13.

  • Solution: Hide system derivedUITextSelectionViewRelated components
Struct {.....; // struct {..... unsigned int trackingDeleteBackward : 1; ///< track deleteBackward operation unsigned int trackingTouchBegan : 1; /// < track touchesBegan event } _state; /// method override#pragma mark - override- (void)addSubview (UIView *)view{// Solve the blue dot problem Class Cls_selectionGrabberDot = NSClassFromString(@)"UISelectionGrabberDot");
    if([view isKindOfClass:[Cls_selectionGrabberDot class]]) { view.backgroundColor = [UIColor clearColor]; view.tintColor = [UIColor clearColor]; view.size = CGSizeZero; Class Cls_selectionView = NSClassFromString(@)"UITextSelectionView");

    if([view isKindOfClass:[Cls_selectionView class]]) { view.backgroundColor = [UIColor clearColor]; view.tintColor = [UIColor clearColor]; view.hidden = YES; } [super addSubview:view]; // Replace the range with the text, and change the '_selectTextRange'. // thecaller should make sure the `range` and `text` are valid before call this method.
- (void)_replaceRange:(YYTextRange *)range withText:(NSString *)text notifyToDelegate:(BOOL)notify{
    if (_isExcludeNeed) {
        notify = NO;
    }

    if(NSEqualRanges (range. AsRange _selectedTextRange. AsRange)) {/ / proxy approach here need to comment out [abolish] / /if(notify) [_inputDelegate selectionWillChange:self]; /// in iOS13, the double cursor problem is caused by this.if (_state.trackingDeleteBackward)[_inputDelegate selectionWillChange:self];
        NSRange newRange = NSMakeRange(0, 0);
        newRange.location = _selectedTextRange.start.offset + text.length;
        _selectedTextRange = [YYTextRange rangeWithRange:newRange];
        //if(notify) [_inputDelegate selectionDidChange:self]; /// in iOS13, the double cursor problem is caused by this.if(_state.trackingDeleteBackward) [_inputDelegate selectionDidChange:self]; . / / / restore tag _state trackingDeleteBackward = NO; }else{... . } - (void) deleteBackward {/ / identify delete action: used to solve the problem of double cursor related _state. TrackingDeleteBackward = YES; [self _updateIfNeeded]; . . } - (void)_updateSelectionView { _selectionView.frame = _containerView.frame; _selectionView.caretBlinks = NO; _selectionView.caretVisible = NO; _selectionView.selectionRects = nil; . .if(@ the available (iOS 13.0, *)) {if (_state.trackingTouchBegan) [_inputDelegate selectionWillChange:self];
        [[YYTextEffectWindow sharedWindow] showSelectionDot:_selectionView];
        if (_state.trackingTouchBegan) [_inputDelegate selectionDidChange:self];
    }else{
         [[YYTextEffectWindow sharedWindow] showSelectionDot:_selectionView];
    }

    if (containsDot) {
        [self _startSelectionDotFixTimer];
    } else{ [self _endSelectionDotFixTimer]; . . }Copy the code
New edit gesture in iOS13Temporarily disable

Edit Gesture Description Reference Copy: three fingers pinch cut: two three fingers pinch paste: three fingers loosen undo: three fingers swipe left (or three fingers double click) Redo: three fingers swipe right Shortcut menu: three fingers click

#ifdef __IPHONE_13_0
- (UIEditingInteractionConfiguration)editingInteractionConfiguration{
    return UIEditingInteractionConfigurationNone;
}
#endif
Copy the code

UITabbar

The UITabbar hierarchy has changed and you cannot remove the top line by setting shadowImage. @lao Xu ooo feedback

  • Solution:stackoverflow It turns itself into OC
if #available(iOS 13, *) {
  let appearance = self.tabBar.standardAppearance.copy()
  appearance.backgroundImage = UIImage()
  appearance.shadowImage = UIImage()
  appearance.shadowColor = .clear
  self.tabBar.standardAppearance = appearance
} else {
  self.tabBar.shadowImage = UIImage()
  self.tabBar.backgroundImage = UIImage()
}
Copy the code
The UITabBar frame setting is invalid
To verify theCopy the code

LayoutSubviews related

// Higher fault tolerance // Specific need to be addedCopy the code

removeFromSuperview

SVProgressHUD displays a document blank on iOS13. Switch to iOS11, ios12, etc.

  • Related code snippetSVProgressHUD
- (void)dismiss { NSDictionary *userInfo = [self notificationUserInfo]; [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDWillDisappearNotification object:nil userInfo:userInfo]; self.activityCount = 0; [UIView animateWithDuration: 0.15 delay: 0 options: UIViewAnimationCurveEaseIn | UIViewAnimationOptionAllowUserInteraction Animations :^{self.hudview. transform = CGAffineTransformScale(self.hudview. transform, 0.8F, 0.8f);if(self.isclear) // Handle iOS 7 UIToolbar not answer well to hierarchy change self.hudview. Alpha = 0.0f;elseThe self. The alpha = 0.0 f; } completion:^(BOOL finished){if(self. Alpha = = 0.0 f | | self. HudView. Alpha = = 0.0 f) {self. Alpha = 0.0 f; Self. HudView. Alpha = 0.0 f; [[NSNotificationCenter defaultCenter] removeObserver:self]; [self cancelRingLayerAnimation]; [_hudView removeFromSuperview]; _hudView = nil; [_overlayView removeFromSuperview]; _overlayView = nil; [_indefiniteAnimatedView removeFromSuperview]; _indefiniteAnimatedView = nil; UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil); [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDDidDisappearNotification object:nil userInfo:userInfo]; // Tell the rootViewController to update the StatusBar appearance#if ! defined(SV_APP_EXTENSIONS)
                             UIViewController *rootController = [[UIApplication sharedApplication] keyWindow].rootViewController;
                             if ([rootController respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
                                 [rootController setNeedsStatusBarAppearanceUpdate];
                             }
#endif
                             // uncomment to make sure UIWindow is gone from app.windows
                             //NSLog(@"% @", [UIApplication sharedApplication].windows);
                             //NSLog(@"keyWindow = %@", [UIApplication sharedApplication].keyWindow); }}]; }... . - (UILabel *)stringLabel {if(! _stringLabel) { _stringLabel = [[UILabel alloc] initWithFrame:CGRectZero]; _stringLabel.backgroundColor = [UIColor clearColor]; _stringLabel.adjustsFontSizeToFitWidth = YES; _stringLabel.textAlignment = NSTextAlignmentCenter; _stringLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters; _stringLabel.numberOfLines = 0; }if(! _stringLabel.superview){ [self.hudView addSubview:_stringLabel]; } _stringLabel.textColor = SVProgressHUDForegroundColor; _stringLabel.font = SVProgressHUDFont;return _stringLabel;
}
Copy the code

Superview: _stringLabel.superview: _hudView removeFromSuperview IOS12 < _stringLabel.superview = nil iOS13 _stringLabel.superview! = nil

Note: Think twice about using view.superview in the future

A broken virus codeNote: this parameter is available only in iOS13 or later

DEV debugging has No Problem — No Problem Adhoc and Release, as long as the user manually operates the front and background switch once, the following method will die. — This problem is due to a combination of factors that you don’t necessarily encounter.

#pragma Mark - Rotate the screen
+(void)changeOrientation:(UIInterfaceOrientation)toOrientation{
 
  if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
        SEL selector = NSSelectorFromString(@"setOrientation:");
        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDeviceinstanceMethodSignatureForSelector:selector]];
        [invocation setSelector:selector];
        [invocation setTarget:[UIDevice currentDevice]];
        int val = UIInterfaceOrientationLandscapeRight;
        [invocation setArgument:&val atIndex:2]; [invocation invoke]; }}Copy the code
  • Solution:Suspected function internal stack pointer error
The solution seems simple enough to add a few lines of code in the header of a method function that the compiler won't tune out.#pragma Mark - Rotate the screen
+(void)changeOrientation:(UIInterfaceOrientation)toOrientation{
  
  [self uploadLog:@"Rotate screen"];

  if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
        SEL selector = NSSelectorFromString(@"setOrientation:");
        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDeviceinstanceMethodSignatureForSelector:selector]];
        [invocation setSelector:selector];
        [invocation setTarget:[UIDevice currentDevice]];
        int val = UIInterfaceOrientationLandscapeRight;
        [invocation setArgument:&val atIndex:2]; [invocation invoke]; }}Copy the code

Status bar correlation

Show and hide the status bar

[Plan 1]

Although the following method is classified as DEPRECATED, it still works on iOS13.

- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation API_DEPRECATED("Use -[UIViewController prefersStatusBarHidden]"Ios (3.2, 9.0)) API_UNAVAILABLE (tvos);Copy the code

[Plan 2]

Bizarre technique: It is possible to make the global status bar invisible by copying the private method, but it is not recommended.

!!!!!!!!! Better not to try!!Copy the code
Get the status barNote That a status bar is created and may be inconsistent with the current system status bar
        if(@ the available (iOS 13.0, *)) { UIView *_localStatusBar = [[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager performSelector:@selector(createLocalStatusBar)]; UIView * statusBar = [_localStatusBar performSelector:@selector(statusBar)]; / / note that this code does not take effect For drawing / / [statusBar drawViewHierarchyInRect: statusBar. Bounds afterScreenUpdates: NO]; [statusBar.layer renderInContext:context]; }else {
            // Fallback on earlier versions
        }
Copy the code
Status bar in landscape modeDisplayed on the left or right

Cause 1: The UIViewController to which the video player belongs is not rotated correctly. Reason 2: iOS13 API failure under the [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft];

  • Solution:
Allows controller rotation, iOS13 landscape hides the status bar automatically.Copy the code
  • The status bar sets the background color

Because the current status bar is actually taken over by the system in iOS13, it’s not available. 🐶 or there’s an API I haven’t found

  • Solution:
    UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
    UIView *viewStatusColorBlend = [[UIView alloc]initWithFrame:keyWindow.windowScene.statusBarManager.statusBarFrame];
    viewStatusColorBlend.backgroundColor = Color;
    [keyWindow addSubview:viewStatusColorBlend];
Copy the code
The status bar is displayed in landscape mode

[Plan 1]

For iOS13, the following needs to be clarified:

  1. IOS13 device support, different devices have different performance.
  2. There is no guarantee that the plan will be approved by Apple,Please be careful!! Please be careful!! Please be careful!!
  3. Creating a local status bar can have an uncertain impact on the system status bar, so the following method should be used with cautionaddSubViewremoveFromSuperview.
  • Unsupported device image source

  • Status bar representation on different devices

A: iPhone X ~ iPhone … Max (Bangs) : The status bar displays information such as time in the upper left corner and 🔋 in the upper right corner. In iOS13, the status bar is not displayed in landscape mode.

B: iPhone7 to iPhone 8P (rectangular screen) : The status bar is divided into three segments: left, middle, and right. The time is displayed in the middle, and the horizontal screen is not displayed in iOS13.

C: iPAD (face pasting) : the status bar is displayed in two sections, including the time in the upper left corner and 🔋 in the upper right corner. The status bar is displayed in iOS13 (correction: iPAD OS13) by default.

Conclusion: A and B require special treatment

  • Results the preview

  • Solution: Refer to getting the status bar above
/** status bar --iOS13 */ @property (nonatomic, strong) UIView *viewStatusBar API_AVAILABLE(ios(13.0)); - (UIView *)viewStatusBar{if(! _viewStatusBar) {#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"_viewStatusBar = [[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager performSelector:@selector(createLocalStatusBar)]; _viewStatusBar.backgroundColor = [UIColor clearColor]; _viewStatusBar.hidden = YES; _viewStatusBar.tag = 784321; _viewStatusBar.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; // manually set statusBar to white UIView *statusBar = [[_viewStatusBar valueForKey:@"_statusBar"]valueForKey:@"_statusBar"];
        [statusBar performSelector:@selector(setForegroundColor:) withObject:[UIColor whiteColor]];
#pragma clang diagnostic pop
    }
    return _viewStatusBar;
}

#param mark - Landscape method
- (void)setOrientationLandscapeConstraint {/ / status bar processingif(@ the available (iOS 13.0, *)) {if(! [self viewWithTag:784321] && ! DP_IS_IPAD){ self.viewStatusBar.hidden = NO; [self addSubview:self.viewStatusBar]; // CGFloat fltLeftMargin = DP_IS_IPHONEX? (24) : 0; CGFloat fltTopMargin = DP_IS_IPHONEX ? (12) : 0; UIView *leftView = DP_IS_IPHONEX ? self.lblTitle : self; [self.viewStatusBar mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(leftView.mas_left).offset(fltLeftMargin); make.top.mas_equalTo(fltTopMargin); make.right.mas_equalTo(0); }]; }}}#param mark - Portrait method
- (void)setOrientationPortraitConstraint {/ / status bar processingif(@ the available (iOS 13.0, *)) {if(! DP_IS_IPAD) { self.viewStatusBar.hidden = YES;if([self viewWithTag:784321]) { [self.viewStatusBar removeFromSuperview]; }}}}Copy the code
  • The original hope is to achieve the same effect as iQiyi, but the above way has met the demand if the successful review.Of course, if which big guy know how to achieve, but also hope to give advice.

[Plan 2] Key: Display the system status bar

The solution uses the native status bar instead of being created through a private API. One extra note: attempts to modify the status bar Frame failed, although it displayed normally.

@implementation UIStatusBarManager (Extend) /// Change the default configuration - (CGFloat)defaultStatusBarHeightInOrientation:(UIInterfaceOrientation)orientation {if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight ) { /// It's mainly herereturn20; } /// This section is only an example. You need to adapt to different devices.return 44;
}

@end
Copy the code

[Scheme 3] Verification assistance: The built-in video player of Alook browser has basically the same effect as iQiyi. The author has made it clear that the horizontal screen status bar is self-realization rather than system.

Analysis of iQiyi implementation, personal opinion: mainly about the implementation plan

  1. Video final page composition: only supports portrait controller + custom bearing video playerUIWindow
  2. Vertical and horizontal logic: a modal controller pops up to control the rotation direction of the real, but its content must be transparent. (Video final page (portrait) –> Transparent mode controller (landscape))
  3. Video player UIWindow transition effect
  • Note: This API is dead, which is why a lot of people have been looking for a vertical or horizontal alternative.
 [[UIApplication sharedApplication] setStatusBarOrientation:currentOrientation animated:NO];
Copy the code
  • A private method found during debugging: it was supposed to replace the above method, but the actual call had no effect.
setStatusBarOrientation:fromOrientation:windowScene:animationParameters:updateBlock:
Copy the code

[Plan 3] It was realized by analyzing IQiyi with iPAPatch

Landscape display of power and time, CustomUIView no doubt.

The video switches between vertical and horizontal screens using a new CustomUIWindow, but its rootViewController is Push instead of modal.

CustomUIWindow replaces UIWindow as keyWindow and uses its rootViewController to control the actual orientation of the current screen.

  • Verification code:Actual effect is equivalent to the [[UIApplication sharedApplication] setStatusBarOrientation: currentOrientation animated: NO];

+(void)changeOrientation:(UIInterfaceOrientation)toOrientation{UIApplication * app = [UIApplication sharedApplication]; UIWindow * appWindow = app.delegate.window; CGRect rect = CGRectMake(0, 0, 30, 30); // Here we can actually pass toOrientation to TempViewController forif(! _customWindow) { _customWindow = [[UIWindow alloc] initWithFrame:rect]; _customWindow.backgroundColor = [UIColor cyanColor]; TempViewController * viewctrl = [[TempViewController alloc] init]; _customWindow.rootViewController = viewctrl; } // It is not necessary to replace keyWindow, just ensure that only one of the multiple Windows can support rotation. //[_customWindow makeKeyAndVisible]; }Copy the code
#import "TempViewController.h"

@interface TempViewController ()

@end

@implementation TempViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor greenColor];
    
    UIView *viewRed = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 10)];
    viewRed.backgroundColor = [UIColor redColor];
    [self.view addSubview:viewRed];
    
}

- (BOOL)shouldAutorotate{
    return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}


@end
Copy the code
Summary: This is the summary of the horizontal and vertical screen and status bar issues.

Code specification issuesNSDate

named

Frankfan1990 When the application switched to the background and crashed, the global breakpoint could not be caught and directly broke into the main function.

Cause: self-implemented NSDate category, which has a method called +(NSInterger)now. This method has been implemented in iOS13, and the specific crash reason needs to be verified.

Solution: Rewrite the system to provide methods or new methods, pay attention to avoid conflicts. It is best to name with a suffix or prefix, and this applies to attributes as well.

Has a novelty technologyPlease note that

The ternary operator result = x? x:y; ==> result = x? :y;

The above tips may not give you the results you want, possibly due to changes in the Xcode11 compiler or compiler.Copy the code

VOIP related

@2742810c4ba1 Feedback to the background can not receive the push, and there is an error flash back.

It is mentioned that the data structure of push has changed and the SDK needs to be updated.

3D Touch && Haptic Touch

Support the judgment

Note: Use this judgment and be directreturnYou might also miss out on Haptic Touch. TraitCollection. ForceTouchCapability = = UIForceTouchCapabilityUnavailable may be due to the negligence of apple, Haptic's ability to Touch not and 3 d Touch is unified. The only way I can think of to tell is through the system version. // Whether touch force detection is supportedif(self. Window. TraitCollection. ForceTouchCapability = = UIForceTouchCapabilityUnavailable) {/ / does not support touch strength test, Check whether Haptic Touch is supported. //haptic Touch: the criteria are iOS 13.0 or later.if(@available(iOS 13.0, *)) {}else{
            return; }}Copy the code

supplement

Status bar debugging supplement

During the debugging process, some relevant data were dug up. It will be posted below. I am not very satisfied with the status bar. So I hope interested friends can find the best plan together.

Configuration and structure
  • Why is iOS13 landscape not showing the status bar?

  • Status bar hierarchy

Private method mining
  • UIStatusBarManager
.cxx_destruct
setWindowScene:
_settingsDiffActionsForScene:
initWithScene:
_scene
_setScene:
windowScene
isStatusBarHidden
defaultStatusBarHeightInOrientation:
statusBarStyle
statusBarHeight
updateStatusBarAppearance
updateLocalStatusBars
statusBarHidden
statusBarAlpha
setupForSingleLocalStatusBar
statusBarFrameForStatusBarHeight:
updateStatusBarAppearanceWithAnimationParameters:
_updateStatusBarAppearanceWithClientSettings:transitionContext:animationParameters:
_updateVisibilityForWindow:targetOrientation:animationParameters:
_updateStyleForWindow:animationParameters:
_updateAlpha
_visibilityChangedWithOriginalOrientation:targetOrientation:animationParameters:
activateLocalStatusBar:
_updateLocalStatusBar:
statusBarFrame
_handleScrollToTopAtXPosition:
_adjustedLocationForXPosition:
updateStatusBarAppearanceWithClientSettings:transitionContext:
deactivateLocalStatusBar:
createLocalStatusBar
handleTapAction:
localStatusBars
setLocalStatusBars:
statusBarPartStyles
isInStatusBarFadeAnimation
debugMenuHandler
setDebugMenuHandler:
Copy the code
  • UIStatusBar_Modern
.cxx_destruct
 layoutSubviews
 intrinsicContentSize
 setMode:
 setOrientation:
 currentStyle
 forceUpdate:
 statusBar
 setStatusBar:
 forceUpdateData:
 setEnabledPartIdentifiers:
 setAvoidanceFrame:
 frameForPartWithIdentifier:
 alphaForPartWithIdentifier:
 setAlpha:forPartWithIdentifier:
 setOffset:forPartWithIdentifier:
 jiggleLockIcon
 setForegroundColor:animationParameters:
 setStyleRequest:animationParameters:
 enabledPartIdentifiers
 setAction:forPartWithIdentifier:
 statusBarServer:didReceiveStatusBarData:withActions:
 statusBarServer:didReceiveStyleOverrides:
 statusBarServer:didReceiveDoubleHeightStatusString:forStyle:
 statusBarStateProvider:didPostStatusBarData:withActions:
 defaultDoubleHeight
 setForegroundAlpha:animationParameters:
 _effectiveStyleFromStyle:
 actionForPartWithIdentifier:
 offsetForPartWithIdentifier:
 _initWithFrame:showForegroundView:wantsServer:inProcessStateProvider:
 setLegibilityStyle:animationParameters:
 _requestStyle:partStyles:animationParameters:forced:
 _implicitStyleOverrideForStyle:
 _effectiveDataFromData:activeOverride:canUpdateBackgroundActivity:
 _updateWithData:force:
 _requestStyle:partStyles:legibilityStyle:foregroundColor:animationParameters:
 _updateSemanticContentAttributeFromLegacyData:
 _dataFromLegacyData:
Copy the code
  • _UIStatusBarLocalView
.cxx_destruct
initWithFrame:
willMoveToWindow:
statusBar
setStatusBar:
Copy the code
  • _UIStatusBar
description
.cxx_destruct
setAction:
action
layoutSubviews
intrinsicContentSize
mode
initWithStyle:
setMode:
items
style
orientation
setOrientation:
foregroundColor
containerView
_updateDisplayedItemsWithData:styleAttrib
updateConstraints
setStyle:
gestureRecognizerShouldBegin:
currentData
traitCollectionDidChange:
setItems:
setForegroundColor:
areAnimationsEnabled
setSemanticContentAttribute:
updateWithData:
setStyleAttributes:
styleAttributes
itemWithIdentifier:
regions
_traitCollectionForChildEnvironment:
_accessibilityHUDGestureManager:HUDItemFo
_accessibilityHUDGestureManager:gestureLi
_accessibilityHUDGestureManager:shouldRec
_accessibilityHUDGestureManager:shouldTer
_accessibilityHUDGestureManager:showHUDIt
_dismissAccessibilityHUDForGestureManager
foregroundView
actionGestureRecognizer
avoidanceFrame
setEnabledPartIdentifiers:
setAvoidanceFrame:
frameForPartWithIdentifier:
alphaForPartWithIdentifier:
setAlpha:forPartWithIdentifier:
setOffset:forPartWithIdentifier:
enabledPartIdentifiers
setOverlayData:
setAction:forPartWithIdentifier:
setStyle:forPartWithIdentifier:
overlayData
updateCompletionHandler
setUpdateCompletionHandler:
setForegroundView:
visualProvider
_forceLayoutEngineSolutionInRationalEdges
resizeSubviewsWithOldSize:
currentAggregatedData
updateWithAnimations:
styleAttributesForStyle:
displayItemIdentifiersInRegionsWithIdenti
frameForDisplayItemWithIdentifier:
frameForPartWithIdentifier:includeInterna
dataAggregator
displayItemWithIdentifier:
regionWithIdentifier:
stateForDisplayItemWithIdentifier:
setDisplayItemStates:
_updateWithAggregatedData:
statusBarGesture:
_setVisualProviderClass:
_visualProviderClass
_prepareVisualProviderIfNeeded
_effectiveTargetScreen
_updateStyleAttributes
_performWithInheritedAnimation:
_effectiveStyleFromStyle:
_updateWithData:completionHandler:
_prepareAnimations:
_performAnimations:
_fixupDisplayItemAttributes
_delayUpdatesWithKeys:fromAnimation:
_updateRegionItems
_rearrangeOverflowedItems
_frameForActionable:actionInsets:
_gestureRecognizer:touchInsideActionable:
_gestureRecognizer:pressInsideActionable:
_frameForActionable:
_pressFrameForActionable:
_gestureRecognizer:isInsideActionable:
_regionsForPartWithIdentifier:includeInte
_actionablesForPartWithIdentifier:include
_itemWithIdentifier:createIfNeeded:
_statusBarWindowForAccessibilityHUD
_setVisualProviderClassName:
_visualProviderClassName
resetVisualProvider
actionForPartWithIdentifier:
offsetForPartWithIdentifier:
styleForPartWithIdentifier:
dependentDataEntryKeys
animationContextId
itemsDependingOnKeys:
itemIdentifiersInRegionsWithIdentifiers:
dataEntryKeysForItemsWithIdentifiers:
targetScreen
setTargetScreen:
displayItemStates
targetActionable
setTargetActionable:
accessibilityHUDGestureManager
setAccessibilityHUDGestureManager:
Copy the code
The relevant dataYou can see how people dig up information, right
(lldb) po [statusBar performSelector:@selector(currentData)]
<_UIStatusBarData: 0x7fee29fdada0: 
mainBatteryEntry=<_UIStatusBarDataBatteryEntry: 0x600001713c90: isEnabled=1, capacity=100, state=2, saverModeActive=0, prominentlyShowsDetailString=0, detailString=100%>, 
secondaryCellularEntry=<_UIStatusBarDataCellularEntry: 0x600003c4d9e0: isEnabled=1, rawValue=0, displayValue=0, displayRawValue=0, status=0, lowDataModeActive=0, type=5, wifiCallingEnabled=0, callForwardingEnabled=0, showsSOSWhenDisabled=0>, 
backNavigationEntry=<_UIStatusBarDataStringEntry: 0x60000191e540: isEnabled=0>, 
vpnEntry=<_UIStatusBarDataEntry: 0x600001aae360: isEnabled=0>,
radarEntry=<_UIStatusBarDataBoolEntry: 0x600001aae280: isEnabled=0, boolValue=0>, 
rotationLockEntry=<_UIStatusBarDataEntry: 0x600001aadf20: isEnabled=0>, dateEntry=<_UIStatusBarDataStringEntry: 0x60000191e560: isEnabled=1, stringValue=Thu Sep 26>, 
quietModeEntry=<_UIStatusBarDataBoolEntry: 0x600001aae250: isEnabled=0, boolValue=0>, 
timeEntry=<_UIStatusBarDataStringEntry: 0x60000191e580: isEnabled=1, stringValue=5:15 PM>, 
personNameEntry=<_UIStatusBarDataStringEntry: 0x60000191e5a0: isEnabled=0>, 
cellularEntry=<_UIStatusBarDataCellularEntry: 0x600003c4da40: isEnabled=1, rawValue=0, displayValue=0, displayRawValue=0, status=1, lowDataModeActive=0, type=5, string=Carrier, wifiCallingEnabled=0, callForwardingEnabled=0, showsSOSWhenDisabled=0>, 
assistantEntry=<_UIStatusBarDataEntry: 0x600001aae210: isEnabled=0>, 
bluetoothEntry=<_UIStatusBarDataBluetoothEntry: 0x60000191e5c0: isEnabled=0, state=0>, 
ttyEntry=<_UIStatusBarDataEntry: 0x600001aacbc0: isEnabled=0>, 
voiceControlEntry=<_UIStatusBarDataVoiceControlEntry: 0x60000191e5e0: isEnabled=0, type=0>, 
carPlayEntry=<_UIStatusBarDataEntry: 0x600001aacc00: isEnabled=0>, 
wifiEntry=<_UIStatusBarDataWifiEntry: 0x6000003b2880: isEnabled=1, rawValue=0, displayValue=3, displayRawValue=0, status=5, lowDataModeActive=0, type=0>, 
liquidDetectionEntry=<_UIStatusBarDataEntry: 0x600001aae160: isEnabled=0>, 
shortTimeEntry=<_UIStatusBarDataStringEntry: 0x60000191e600: isEnabled=1, stringValue=5:15>, 
studentEntry=<_UIStatusBarDataEntry: 0x600001aaeac0: isEnabled=0>, 
tetheringEntry=<_UIStatusBarDataTetheringEntry: 0x60000191e620: isEnabled=0, connectionCount=0>, 
alarmEntry=<_UIStatusBarDataEntry: 0x600001aae0e0: isEnabled=0>, 
activityEntry=<_UIStatusBarDataActivityEntry: 0x60000191e640: isEnabled=0, type=0, displayId=com.driver.feng>, 
locationEntry=<_UIStatusBarDataLocationEntry: 0x60000191e660: isEnabled=0, type=1>, 
airPlayEntry=<_UIStatusBarDataEntry: 0x600001aadfc0: isEnabled=0>, 
deviceNameEntry=<_UIStatusBarDataStringEntry: 0x60000191e680: isEnabled=0>, 
lockEntry=<_UIStatusBarDataLockEntry: 0x60000191e6a0: isEnabled=0, unlockFailureCount=0>, 
electronicTollCollectionEntry=<_UIStatusBarDataBoolEntry: 0x600001aae030: isEnabled=0, boolValue=0>, 
thermalEntry=<_UIStatusBarDataThermalEntry: 0x60000191e6c0: isEnabled=0, color=0, sunlightMode=0>, 
backgroundActivityEntry=<_UIStatusBarDataBackgroundActivityEntry: 0x600001713ed0: isEnabled=0, type=0>, 
forwardNavigationEntry=<_UIStatusBarDataStringEntry: 0x60000191e700: isEnabled=0>, 
airplaneModeEntry=<_UIStatusBarDataEntry: 0x600001aadfa0: isEnabled=0>>

Copy the code
(lldb) po [statusBar performSelector:@selector(items)]
{
    "<_UIStatusBarIdentifier: 0x600001907300: object=_UIStatusBarIndicatorTTYItem>" = "<_UIStatusBarIndicatorTTYItem: 0x6000003b1d40: identifier=<_UIStatusBarIdentifier: 0x600001907300: object=_UIStatusBarIndicatorTTYItem>>";
    "<_UIStatusBarIdentifier: 0x600001903a00: object=_UIStatusBarTimeItem>" = "<_UIStatusBarTimeItem: 0x600003b7f610: identifier=<_UIStatusBarIdentifier: 0x600001903a00: object=_UIStatusBarTimeItem>>";
    "<_UIStatusBarIdentifier: 0x600001907380: object=_UIStatusBarIndicatorAlarmItem>" = "<_UIStatusBarIndicatorAlarmItem: 0x6000003b1e00: identifier=<_UIStatusBarIdentifier: 0x600001907380: object=_UIStatusBarIndicatorAlarmItem>>";
    "<_UIStatusBarIdentifier: 0x600001906f80: object=_UIStatusBarSpacerItem>" = "<_UIStatusBarSpacerItem: 0x60000177ea00: identifier=<_UIStatusBarIdentifier: 0x600001906f80: object=_UIStatusBarSpacerItem>>";
    "<_UIStatusBarIdentifier: 0x600001903d60: object=_UIStatusBarActivityItem_Split>" = "<_UIStatusBarActivityItem_Split: 0x6000003b2000: identifier=<_UIStatusBarIdentifier: 0x600001903d60: object=_UIStatusBarActivityItem_Split>>";
    "<_UIStatusBarIdentifier: 0x600001903960: object=_UIStatusBarCellularCondensedItem>" = "<_UIStatusBarCellularCondensedItem: 0x600002aa8ea0: identifier=<_UIStatusBarIdentifier: 0x600001903960: object=_UIStatusBarCellularCondensedItem>>";
    "<_UIStatusBarIdentifier: 0x600001903a80: object=_UIStatusBarVoiceControlPillItem>" = "<_UIStatusBarVoiceControlPillItem: 0x600003b7f980: identifier=<_UIStatusBarIdentifier: 0x600001903a80: object=_UIStatusBarVoiceControlPillItem>>";
    "<_UIStatusBarIdentifier: 0x600001907400: object=_UIStatusBarIndicatorRotationLockItem>" = "<_UIStatusBarIndicatorRotationLockItem: 0x6000003b1e40: identifier=<_UIStatusBarIdentifier: 0x600001907400: object=_UIStatusBarIndicatorRotationLockItem>>";
    "<_UIStatusBarIdentifier: 0x600001907000: object=_UIStatusBarBluetoothItem>" = "<_UIStatusBarBluetoothItem: 0x6000003b1f00: identifier=<_UIStatusBarIdentifier: 0x600001907000: object=_UIStatusBarBluetoothItem>>";
    "<_UIStatusBarIdentifier: 0x600001906ee0: object=_UIStatusBarIndicatorAirplaneModeItem>" = "<_UIStatusBarIndicatorAirplaneModeItem: 0x6000003b2080: identifier=<_UIStatusBarIdentifier: 0x600001906ee0: object=_UIStatusBarIndicatorAirplaneModeItem>>";
    "<_UIStatusBarIdentifier: 0x600001907760: object=_UIStatusBarBuildVersionItem>" = "<_UIStatusBarBuildVersionItem: 0x60000177e310: identifier=<_UIStatusBarIdentifier: 0x600001907760: object=_UIStatusBarBuildVersionItem>>";
    "<_UIStatusBarIdentifier: 0x600001906d20: object=_UIStatusBarIndicatorVPNItem>" = "<_UIStatusBarIndicatorVPNItem: 0x6000003b1fc0: identifier=<_UIStatusBarIdentifier: 0x600001906d20: object=_UIStatusBarIndicatorVPNItem>>";
    "<_UIStatusBarIdentifier: 0x600001907480: object=_UIStatusBarIndicatorQuietModeItem>" = "<_UIStatusBarIndicatorQuietModeItem: 0x6000003b1e80: identifier=<_UIStatusBarIdentifier: 0x600001907480: object=_UIStatusBarIndicatorQuietModeItem>>";
    "<_UIStatusBarIdentifier: 0x6000019075a0: object=_UIStatusBarActivityItem_SyncOnly>" = "<_UIStatusBarActivityItem_SyncOnly: 0x60000177dad0: identifier=<_UIStatusBarIdentifier: 0x6000019075a0: object=_UIStatusBarActivityItem_SyncOnly>>";
    "<_UIStatusBarIdentifier: 0x6000019076c0: object=_UIStatusBarIndicatorLiquidDetectionItem>" = "<_UIStatusBarIndicatorLiquidDetectionItem: 0x6000003b1f40: identifier=<_UIStatusBarIdentifier: 0x6000019076c0: object=_UIStatusBarIndicatorLiquidDetectionItem>>";
    "<_UIStatusBarIdentifier: 0x600001907080: object=_UIStatusBarThermalItem>" = "<_UIStatusBarThermalItem: 0x6000003b1c80: identifier=<_UIStatusBarIdentifier: 0x600001907080: object=_UIStatusBarThermalItem>>";
    "<_UIStatusBarIdentifier: 0x600001906dc0: object=_UIStatusBarSecondaryCellularExpandedItem>" = "<_UIStatusBarSecondaryCellularExpandedItem: 0x60000366c380: identifier=<_UIStatusBarIdentifier: 0x600001906dc0: object=_UIStatusBarSecondaryCellularExpandedItem>>";
    "<_UIStatusBarIdentifier: 0x600001907500: object=_UIStatusBarIndicatorLocationItem>" = "<_UIStatusBarIndicatorLocationItem: 0x6000003b1ec0: identifier=<_UIStatusBarIdentifier: 0x600001907500: object=_UIStatusBarIndicatorLocationItem>>";
    "<_UIStatusBarIdentifier: 0x600001907100: object=_UIStatusBarIndicatorAssistantItem>" = "<_UIStatusBarIndicatorAssistantItem: 0x6000003b1cc0: identifier=<_UIStatusBarIdentifier: 0x600001907100: object=_UIStatusBarIndicatorAssistantItem>>";
    "<_UIStatusBarIdentifier: 0x600001907620: object=_UIStatusBarBatteryItem>" = "<_UIStatusBarBatteryItem: 0x600003b7f4d0: identifier=<_UIStatusBarIdentifier: 0x600001907620: object=_UIStatusBarBatteryItem>>";
    "<_UIStatusBarIdentifier: 0x600001903de0: object=_UIStatusBarNavigationItem>" = "<_UIStatusBarNavigationItem: 0x60000177fc90: identifier=<_UIStatusBarIdentifier: 0x600001903de0: object=_UIStatusBarNavigationItem>>";
    "<_UIStatusBarIdentifier: 0x600001907180: object=_UIStatusBarIndicatorAirPlayItem>" = "<_UIStatusBarIndicatorAirPlayItem: 0x6000003b1d00: identifier=<_UIStatusBarIdentifier: 0x600001907180: object=_UIStatusBarIndicatorAirPlayItem>>";
    "<_UIStatusBarIdentifier: 0x600001906c60: object=_UIStatusBarWifiItem>" = "<_UIStatusBarWifiItem: 0x6000003b2480: identifier=<_UIStatusBarIdentifier: 0x600001906c60: object=_UIStatusBarWifiItem>>";
    "<_UIStatusBarIdentifier: 0x600001903b60: object=_UIStatusBarVoiceControlItem>" = "<_UIStatusBarVoiceControlItem: 0x6000003b1f80: identifier=<_UIStatusBarIdentifier: 0x600001903b60: object=_UIStatusBarVoiceControlItem>>";
    "<_UIStatusBarIdentifier: 0x600001907200: object=_UIStatusBarIndicatorCarPlayItem>" = "<_UIStatusBarIndicatorCarPlayItem: 0x6000003b1d80: identifier=<_UIStatusBarIdentifier: 0x600001907200: object=_UIStatusBarIndicatorCarPlayItem>>";
    "<_UIStatusBarIdentifier: 0x600001903be0: object=_UIStatusBarPillBackgroundActivityItem>" = "<_UIStatusBarPillBackgroundActivityItem: 0x600003c4d560: identifier=<_UIStatusBarIdentifier: 0x600001903be0: object=_UIStatusBarPillBackgroundActivityItem>>";
    "<_UIStatusBarIdentifier: 0x600001906b20: object=_UIStatusBarCellularExpandedItem>" = "<_UIStatusBarCellularExpandedItem: 0x60000366c280: identifier=<_UIStatusBarIdentifier: 0x600001906b20: object=_UIStatusBarCellularExpandedItem>>";
    "<_UIStatusBarIdentifier: 0x600001907280: object=_UIStatusBarIndicatorStudentItem>" = "<_UIStatusBarIndicatorStudentItem: 0x6000003b1dc0: identifier=<_UIStatusBarIdentifier: 0x600001907280: object=_UIStatusBarIndicatorStudentItem>>";
}

Copy the code
(lldb) po [statusBar performSelector:@selector(containerView)]
<_UIStatusBarForegroundView: 0x7fee31804f30; frame = (0 0; 375 44); layer = <CALayer: 0x600001907720>>
Copy the code
(lldb) po [statusBar performSelector:@selector(setForegroundColor:) withObject:[UIColor whiteColor]]
UICachedDeviceWhiteColor
Copy the code
(lldb) po [statusBar performSelector:@selector(styleAttributes)] <_UIStatusBarStyleAttributes: 0x60000332fd40: style=-6485417468062910266, mode=-6485417468062910314, traitCollection=<UITraitCollection: 0x600002db61c0; UserInterfaceIdiom = Phone, DisplayScale = 2, DisplayGamut = P3, HorizontalSizeClass = Compact, VerticalSizeClass = Compact, UserInterfaceStyle = Light, UserInterfaceLayoutDirection = LTR, ForceTouchCapability = Unavailable, PreferredContentSizeCategory = L, AccessibilityContrast = Normal, UserInterfaceLevel = Base>, effectiveLayoutDirection=0, iconScale=1, symbolScale=1, textColor=UIExtendedGrayColorSpace 1 1, imageTintColor=UIExtendedGrayColorSpace 1 1, ImageDimmedTintColor = UIExtendedGrayColorSpace 1, 0.2 imageNamePrefixes = ("Split_"."Black_"."Item_") >Copy the code

Message friends, describe the problem clearly and then Po out!

If this article is useful to you, click 👍 and I will be satisfied ~