Xcode11.1 踩坑备忘录

Xcode11.1 踩坑备忘录(mac系统10.15)

1 、环信ChatDemo2.0报错

这是环信ChatDemo2.0报错html

  NSInteger numberOfBeforeSection = [_update[@"oldModel"] numberOfItemsInSection:updateItem.indexPathBeforeUpdate.section];

改成c++

 NSInteger numberOfBeforeSection = [(UICollectionView *)_update[@"oldModel"] numberOfItemsInSection:updateItem.indexPathBeforeUpdate.section];

 

二、暗黑模式暂时不适配的处理

全局配置 在工程的Info.plist的中,增长/修改 UIUserInterfaceStyle为UIUserInterfaceStyleLight或UIUserInterfaceStyleDarkgit

 

三、library not found for -lstdc++.6.0.9

这个在xcode 10也存在的问题,采用大佬的方式处理,道理同样把须要的文件放到对应的路径下。不过大佬写了一个脚本,更方便github

Xcode 10和Xcode 11中删除的libstdc++库    https://github.com/devdawei/libstdc-xcode

 

四、present到登陆页面时,发现新页面不能顶到顶部

缘由是iOS 13 多了一个新的枚举类型 UIModalPresentationAutomatic,而且是modalPresentationStyle的默认值。浏览器

UIModalPresentationAutomatic实际是表现是在 iOS 13的设备上被映射成UIModalPresentationPageSheet。 ruby

可是须要注意一点PageSheet 与 FullScreen 生命周期并不相同 FullScreen会走完整的生命周期bash

,PageSheet由于父视图并无彻底消失,因此viewWillDisappear及viewWillAppear并不会走,app

若是这些方法里有一些处理,仍是换个方式,或者用FullScreen 字体

设置方法:跟暗黑模式同样放到 push的时候或者根视图控制器 self.modalPresentationStyle = UIModalPresentationFullScreen;

 

五、私有API被封禁(KVC限制),禁止访问

一、获取SearchBar的textField

因为在13中把SearchBar中的textField直接暴露给开发者使用,无需在经过kvc获取。

if ([[[UIDevice currentDevice]systemVersion] floatValue] >=     13.0) {

           searchField = _vSearchBar.searchTextField;

    }else{

       searchField = [self valueForKey:@"_searchField"];

    }

二、修改TextFiled的占位符字体大小以及颜色,在iOS13中不能经过KVC来进行修改,能够经过其属性字符串来进行修改

     [_phone setValue:C6 forKeyPath:@"_placeholderLabel.textColor"];

 

UITextField *textfield = [[UITextField alloc]init];
NSMutableAttributedString *arrStr = [[NSMutableAttributedString alloc]initWithString:textfield.placeholder attributes:@{NSForegroundColorAttributeName : [UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:12]}];
textfield.attributedPlaceholder = arrStr;

 

六、Sign in with Apple 第三方登陆

 这个2020年4月前处理了就好

想尝试能够参考https://www.jianshu.com/p/e1284bd8c72a

七、即将废弃的 LaunchImage

从 iOS 8 的时候,苹果就引入了 LaunchScreen,咱们能够设置 LaunchScreen来做为启动页。

固然,如今你还可使用LaunchImage来设置启动图。

不过使用LaunchImage的话,要求咱们必须提供各类屏幕尺寸的启动图,来适配各类设备,随着苹果设备尺寸愈来愈多,这种方式显然不够 Flexible。

而使用 LaunchScreen的话,状况会变的很简单, LaunchScreen是支持AutoLayout+SizeClass的,因此适配各类屏幕都不在话下。

⚠️从2020年4月开始,全部使⽤ iOS13 SDK的 App将必须提供 LaunchScreen,LaunchImage即将退出历史舞台。可使用Launch Storyboards来进行解决。

八、tabBarItem 选中状态的颜色无效,显示默认的蓝色

之前只设置选中状态的颜色是能够的,如今能够这样设置

    [vc.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: MENU_ITEM_SELECTED_COLOR, NSForegroundColorAttributeName, nil] forState:UIControlStateSelected 
if (@available(iOS 13.0, *)) {
        self.tabBar.tintColor = MENU_ITEM_SELECTED_COLOR;

    } else {
        [vc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: MENU_ITEM_SELECTED_COLOR} forState:UIControlStateSelected];
    }

 

PS: xcode11 其余坑,我没踩到

一、废弃 UISearchDisplayController

在 iOS 8 以前,咱们在 UITableView 上添加搜索框须要使用 UISearchBar + UISearchDisplayController 的组合方式,而在 iOS 8 以后,苹果就已经推出了 UISearchController 来代替这个组合方式。在 iOS 13 中,若是还继续使用 UISearchDisplayController 会直接致使崩溃

二、增长一直使用蓝牙的权限申请

CBCentralManager,iOS13之前,使用蓝牙时能够直接用,不会出现权限提示,iOS13后,再使用就会提示了。

在info.plist里增长NSBluetoothAlwaysUsageDescription 咱们要一直使用您的蓝牙,具体作什么别问我

三、UISegmentedControl 默认样式改变

默认样式变为白底黑字,若是设置修改过颜色的话,页面须要修改

四、MPMoviePlayerController在iOS13中废弃

MPMoviePlayerController is no longer available. Use AVPlayerViewController in AVKit.
在iOS13中对于MPMoviePlayerController使用的废弃,须要使用AVKit中的AVPlayerViewController来达到播放的目的。

参考: http://www.javashuo.com/article/p-tmqfmnkb-cz.html

 

备注:

解决MAC系统升级(10.15)致使COCOAPODS失效问题

pod install 报错       sudo gem update --system 也不行  
dunkhomedeMacBook-Pro:get dunkhome$ pod install
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
dunkhomedeMacBook-Pro:get dunkhome$ sudo gem update --system
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

竟然是404,因而我用浏览器打开https://gems.ruby-china.org,发现其服务域名更换了:

而后删除gem源:

gem sources --remove https://gems.ruby-china.org/

修改gem源:

gem sources -a https://gems.ruby-china.com

查看gem源是不是最新的:

gem sources -l

升级cocoapods:

sudo gem install -n /usr/local/bin cocoapods --pre

查看升级后的cocoapods版本:

pod --version  

如今最新的是

MacBook-Pro:get dunkhome$ pod --version 

1.8.3

相关文章
相关标签/搜索