首页 > 其他分享 >iOS 升级到XCode14后适配iOS16

iOS 升级到XCode14后适配iOS16

时间:2022-11-07 11:26:09浏览次数:107  
标签:do end target iOS16 适配 iOS lswiftCoreGraphics 添加 报错

1、解决xcode14 运行报错运行遇到的报错 “error: Signing for “XX” requires a development team.
在podfile文件中添加如下内容 设置User-Defined CODE_SIGNING_ALLOWED = NO

post_install do |installer|
  installer.pods_project.targets.each do |target|
    # 解决xcode14 运行报错运行遇到的报错 “error: Signing for “XX” requires a development team.”
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
 end
end

https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1201464693

2、解决XCode14打包ipa在iOS12.2以下设备闪退的问题

dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib

解决办法:Build Setting ->Other Link Flags下添加-Wl,-weak-lswiftCoreGraphics
如果项目有使用Cocoapods,运行时哪个三方库报这个错,就找到这个报错的库,同样在Build Setting ->Other Link Flags路径下添加这个-Wl,-weak-lswiftCoreGraphics,比如我pods下的JXPageControl这个报错了,就对这个做配置,有几个库报错就添加几个
如果不想手动添加也可以在podfile中添加如下文件自动添加-Wl,-weak-lswiftCoreGraphics

need_otherlinkerflags_frameworks = ['Charts','JXPageControl']

post_install do |installer|
  installer.pods_project.targets.each do |target|
    # 解决XCode14打包ipa在iOS12.2以下设备闪退的问题
    target.build_configurations.each do |config|
      if need_otherlinkerflags_frameworks.include?(target.name)
      config.build_settings['OTHER_LDFLAGS'] = '-Wl,-weak-lswiftCoreGraphics'
   end
  end
 end
end

https://developer.apple.com/forums/thread/714795

标签:do,end,target,iOS16,适配,iOS,lswiftCoreGraphics,添加,报错
From: https://www.cnblogs.com/qqcc1388/p/16865340.html

相关文章