方法1:
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的目录
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_path|
strip_bitcode_from_framework(bitcode_strip_path, framework_path)
end
end
方法2:
1、先cd到需要bitcode的目录中 也就是方法1中的framework_paths具体的目录中
2、查看当前framework是否需要处理的命令
otool -l 你需要处理的framework | grep __LLVM | wc -l
如果返回值大于0 说明当前framework页需要处理。
3、处理当前framework
xcrun bitcode_strip -r 你需要处理的framework -o 你需要处理的framework