Here is the manpage for bitcode_strip
remove or leave the bitcode segment in a Mach-O file
bitcode_strip input [ -r | -m | -l ] -o output
What is a Mach-O file?
Mach-O is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps
Mach-O also happens to be where iOS and OS X executables are stored, as well as bitcode.
Here is the manpage for xcrun
run or locate development tools
xcrun [-sdk SDK] -find <tool_name>
From my understanding after reading the links you have attached, bitcode is an intermediary step in the compilation process. If you submit your source code to apple by itself, apple will end up having different versions of object code in each app, corresponding to the number of different CPU types that OS X and iOS can run on (over 4 different types). Now, apple can compile your source code most of the way into a minimal form called bitcode, which has no baggage related to which CPU it will be run on.
Most of the way: it does the lexer, parser, semantic analysis and code generation parts of the compiler, which is specific to your source code.
The rest of the way: machine-specific things like optimization, assembling, and linking, which is different on an iPhone compared to a macbook, for example
If you submit the bitcode to the app store, it is much easier to finish compiling it into different final forms for different CPU types. It looks like your problem was that the bitcode in your project ended up being quite a large file (this came from Twilio adding support for bitcode). "Stripping" the bitcode basically removed the bitcode from your project (removes the bitcode segment from your Mach-O file), allowing it to fit within your size constraints. The downside is that apple won't have the bitcode, they'll only have the binary (and will not be able to recompile).
Lets break down the code you linked on github:
source 'https://github.com/twilio/cocoapod-specs'
target 'ObjCVideoQuickstart' do
pod 'TwilioVideo', '1.0.0-beta14'
end
post_install do |installer|
# Find bitcode_strip
bitcode_strip_path = `xcrun -sdk iphoneos --find bitcode_strip`.chop!
# Find path to TwilioVideo dependency
path = Dir.pwd
framework_path = "#{path}/Pods/TwilioVideo/TwilioVideo.framework/TwilioVideo"
# Strip Bitcode sections from the framework
strip_command = "#{bitcode_strip_path} #{framework_path} -m -o #{framework_path}"
puts "About to strip: #{strip_command}"
system(strip_command)
end
1.
bitcode_strip_path = `xcrun -sdk iphoneos --find bitcode_strip`.chop!
Locates the bitcode_strip
tool in your Xcode installation (read the manpage linked above for xcrun)
2.
framework_path = "#{path}/Pods/TwilioVideo/TwilioVideo.framework/TwilioVideo"
Finds the framework you want to remove the bitcode from
3.
strip_command = "#{bitcode_strip_path} #{framework_path} -m -o #{framework_path}"
puts "About to strip: #{strip_command}"
system(strip_command)
Creates and executes the command to actually remove the bitcode section from the Mach-O executable. -m
is specified for removal (see the linked manpage for bitcode_strip)
please note: using the solution provided by this twilio employee (or other solutions like this) may not be future-proof, as bitcode may become mandatory in the app store
For more information, look into "app thinning"