Xcode16和iOS18更新的坑

5,381 阅读1分钟

由于xcode15.3有.css文件缓存不了的问题,在xcode16推送更新的第一时间,我就下载了最新的xcode16。预期内,有一堆坑,故在这记录,希望能帮到相同的iOS开发。

1、 Declaration of 'sa_family_t' must be imported from module 'Darwin.POSIX.sys.types._sa_family_t' before it is required
解决

#import <sys/_types/_sa_family_t.h>

2、BRPickerView 在iOS18上报错
Set maskView (<UIView: 0x10860b040; frame = (0 0; 375 812); autoresize = W+RM+H+BM; gestureRecognizers = <NSArray: 0x600000048ba0>; backgroundColor = <UIDynamicProviderColor: 0x600000323260; provider = <__NSMallocBlock__: 0x600000ccd830>>; layer = <CALayer: 0x600000322b60>>) to nil before adding it as a subview of <BRStringPickerView: 0x10836cc70; frame = (0 0; 375 812); autoresize = W+RM+H+BM; layer = <CALayer: 0x600000324f40>>
临时解决

if (!self.pickerStyle.hiddenMaskView) {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)0.2 * NSEC_PER_SEC), dispatch_get_main_queue(),^{
        [self.keyView addSubview:self.maskView];
       });
 }
-(UIView *)maskView {

    if (!_maskView) {

        CGFloat accessoryViewHeight = 0;

        if (self.pickerHeaderView) {

            accessoryViewHeight += self.pickerHeaderView.bounds.size.height;

        }

        if (self.pickerFooterView) {

            accessoryViewHeight += self.pickerFooterView.bounds.size.height;

        }

        CGFloat height = self.pickerStyle.titleBarHeight + self.pickerStyle.pickerHeight + self.pickerStyle.paddingBottom + accessoryViewHeight;

        _maskView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.keyView.bounds.size.width, self.keyView.bounds.size.height- height)];

        _maskView.backgroundColor = self.pickerStyle.maskColor;

        // 设置子视图的大小随着父视图变化

        _maskView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

        _maskView.userInteractionEnabled = YES;

        UITapGestureRecognizer *myTap = [[UITapGestureRecognizer alloc]initWithTarget:self action: @selector(didTapMaskView:)];

        [_maskView addGestureRecognizer:myTap];

    }

    return _maskView;

}

期待BRPickerView官方更新github版本

3.xcode16 log检索过长闪退
解决
等xcode更新😂

4.iOS18的机器跳转支付宝失败....
解决
支付宝sdk版本过低,更新支付宝sdk的版本(巨坑无比,官方偷偷更新sdk,也没有日志)
5.xcode 16 提交审核报bitcode错错误

post_install do |installer|
  bitcode_strip_path = `xcrun --find bitcode_strip`.chop!

  def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)

    framework_path = File.join(Dir.pwd, framework_relative_path)

    command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"

    puts "Stripping bitcode: #{command}"
    system(command)
  end
  framework_paths = [

    "/Pods/NIMSDK/NIMSDK/NIMSDK.framework/NIMSDK",

    "/Pods/NIMSDK/NIMAVChat/NIMAVChat.framework/NIMAVChat",

    "/Pods/NIMSDK/NIMAVChat/NMC.framework/NMC",

    "/Pods/NIMSDK/NIMAVChat/NMCBasicModuleFramework.framework/NMCBasicModuleFramework",
  ]
  framework_paths.each do |framework_relative_path|strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
  end
end

之后pod install framework_paths是里是报错的framework的路径。
注意,这个/pods/后面路径网上分享的朋友都没说清楚.需要鼠标对准framework右键show in findder的路径,而不是xcode报错的路径!!

持续更新中...