iOS 升级到XCode14后适配iOS16

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

posted @   qqcc1388  阅读(1757)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
点击右上角即可分享
微信分享提示