问题说明
由于 xcode16 不支持 framework 开启 bitcode,使用 5.10.4 之前的 IM SDK 可能会遇到打包问题。
如何查看 framework 是否支持 bitcode?
- otool -l framwork路径下的实体文件 | grep __LLVM | wc -l
使用 otool 工具查看 framework 文件的 load commands 内容,然后搜索 load commands 中的__LLVM 个数。
如果上述命令的输出结果有 __LLVM 的个数大于 0,那么就说明,所用的 framework 或 .a 开启了 bitcode,否则没有开启。
otool -arch arm64 -l RongIMKit | grep __LLVM | wc -l
0
如何移除framework中的bitcode?
如果您使用的是 podfile,请添加以下设置:
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
RongCloudIM_Frameworks = [
"RongChatRoom",
"RongContactCard",
"RongCustomerService",
"RongDiscussion",
"RongIMKit",
"RongIMLib",
"RongIMLibCore",
"RongLocation",
"RongLocationKit",
"RongPublicService",
"RongSight",
"RongSticker"
]
RongCloudIM_Frameworks.each do |framework_name|
framework_relative_path ="Pods/RongCloudIM/RongCloudIM/#{framework_name}.xcframework/ios-arm64_armv7/#{framework_name}.framework/#{framework_name}"
strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
end
end
其中, RongCloudIM_Frameworks
请根据具体使用情况设置,该脚本会移除对应 framework 的bitcode,使 Xcode 16 的打包可以通过验证。