I want to create a universal static library, say called sampleStaticLib.a, which gets included in an app called HelloWorld. The HelloWorld app needs to use the APIs defined in the static library, and needs to work on both iOS simulator and iOS device. I understand from various posts in the Internet that I can accomplish this by using the lipo tool to aggregate the static libraries of both the simulator and device into a universal library, and then include the universal library inside the HelloWorld.xcodeproj.
However, alternatively, if I do the following:
- simply set the valid architecture in the static library xcodeproject (sampleStaticLib.xcodeproj) to "armv7 armv7s arm64 i386 x86_64
- generate the sampleStaticLibrary.a
- include it in the HelloWorld.xcodeproj
My expectation is that, since I set the valid architecture of 'sampleStaticLib' to all architectures spanning x86 and ARM, the library should work on both simulator and device. But it doesn't work on the simulator.
So, can't setting a broad "valid architecture" replace the need to use 'lipo tool' while creating universal static libraries?