xcode16 bitcode的问题

2024-09-19  本文已影响0人  O_Ozz

遇到IMSDK构建上的Bitcode问题

上传到Apple TestFlight验证失败,出现错误,提示框架是用位码编译的,这是不允许的。只有在隐式设置位码时,问题才会出现在Xcode 16 RC上,在Xcode 15上构建应该可以正常工作。深入研究,我们看到一些有趣的行为:对于报告的框架,生成的IPA符号不包含它们应该存在的LLVM符号。这可能很棘手,因为一些过时的库或依赖项仍然有位码,无法快速更新。与Xcode 15相比,Xcode 16 RC似乎具有更严格的比特代码验证。解决方法是在构建之前剥离框架的比特代码。

xcrun bitcode_strip -r YourFramework.framework/YourFramework -o YourFramework.framework/YourFramework

如果您使用Cocoapod,您可以利用以下变通方法:

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/LibraryA/LibraryA/dynamic/LibraryA.xcframework/ios-arm64_armv7/LibraryA.framework/LibraryA",

    "Pods/LibraryB/LibraryB.xcframework/ios-arm64_armv7/LibraryB.framework/LibraryB"

  ]

  framework_paths.each do |framework_relative_path|

    strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)

  end

end

上一篇 下一篇

猜你喜欢

热点阅读