Summary of ios13 adaptation and xcode11.0 stepping pit


Problems with presentviewcontroller in ios13

After updating Xcode 11.0 beta, run code discovery in IOS 13presentViewControllerIt is different from the previous pop-up style.

This is mainly because we were right beforeUIViewControllerOne of the attributes ismodalPresentationStyle(this property is the style that the controller will use in modal view) the required type is not set. In ios13modalPresentationStyleThe default for is changed toUIModalPresentationAutomaticBefore, the default isUIModalPresentationFullScreen

 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 in iOS 13.0, and UIModalPresentationFullScreen on previous versions. Defaults to UIModalPresentationFullScreen on all other platforms.
@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle API_AVAILABLE(ios(3.2));

To change the original modal view style, we just need toUIModalPresentationStyleSet toUIModalPresentationFullScreenJust.

ViewController *vc = [[ViewController alloc] init];
vc.title = @"presentVC";
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];

Private KVC

When running a project using IOS 13, the app suddenlycrashIt fell. The problem located is in the settingUITextFieldofPlaceholderThat is, the KVC method is used for the color and font of placeholder text:

[_textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[_textField setValue:[UIFont systemFontOfSize:14] forKeyPath:@"_placeholderLabel.font"];

You can replace it with

_ Textfield. Attributedplaceholder = [[nsattributedstring alloc] initwithstring: @ "name" attributes: @ {nsfontattributename: [UIFont systemfontofsize: 14], nsforegroundcolorattributename: [uicolor redcolor]}];

And it only needs to be set during initializationattributedPlaceholderThat is, the placeholder text of rich text is still used after re assignmentplaceolderSet the text content directly, and the style will not change( If you want this effect, you need to initialize the attributedplaceholder (the string is not empty)

Universal link

To configure universal link in Xcode 11:

Open in safari in other apps before ios13Universal Link(Universal link) the matching domain name of the system is full matching, but the rules have changed since ios13. It is speculated that it is inclusive. For example, before ios13, ifUniversal Link(Universal link) isw.mydomain.comThen visit wechat or other appswww.mydomain.comThen click to open Safari, the corresponding app will not be pulled up, but the corresponding app will be pulled up in ios13.
The link entered in Safari is still the same as before IOS, onlywww.mydomain.comWill prompt to open the corresponding app.

Modify app name (modify displayName value)

  • Default when creating projects in Xcodeproject.pbxprojAll inPRODUCT_NAME = "$(TARGET_NAME)";。
  • Before Xcode 11.0, if you modifyDisplayNameOnly modify wheninfo.plistMediumBundle display nameValue, but changing this value in Xcode 11.0 willproject.pbxprojOne ofPRODUCT_NAMEChange to the modified value, if passed in the project[NSBundle mainBundle] infoDictionary]takekCFBundleExecutableKeyWill have an impact, andBuild SettingsMediumPackaingSome of the names in have an impact, and there may be other impacts to be concerned about.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support developpaer.

Recommended Today

NFS notes (I) working principle and detailed configuration of NFS server

1、 How NFS works 1. What is an NFS server NFS is the abbreviation of network file system. Its biggest function is to enable different machines and different operating systems to share files with each other through the network. Server for NFS allows PC to mount the directory shared by server for NFS in the […]