Tools & releasesHistorical technical note
Packaging an iOS static library as an .a file
Records a workflow for building separate device and simulator static libraries in Xcode, inspecting their architectures with lipo and combining the .a files. It explains matching the target platform during testing and checking the resulting library.
Originally credited to Bison. Content is retained as published.
On this page
"iOS development: generating a static .a library." Plato








Select iOS Device. I recommend leaving the device disconnected here, then running command+b.
Then select a simulator and run command+b.
This produces two .a files.





If you are not testing on a physical device, use the simulator .a file. Otherwise an error occurs.
Next, combine the device and simulator .a files.
cd + .a 路径
Use lipo -info .a文件名 to inspect the file information.
lipo -create xxx/.a文件 xxx/.a文件 -output xxx.a文件
The xxx/.a files refer to the paths of the device and simulator .a files.
The xxx.a file is the generated .a file.
The new file is twice the size of the original. Then test whether it worked.