Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a library for both iPhone simulator and device?

I want to build a static library for iphone. I want to give my users the .a library which they can use for both simulator test and device test. Do I have to build two library in simulator mode and device mode? Is there any way to build a single one that can be used for both platforms?

like image 975
Chilly Zhong Avatar asked Jun 08 '10 09:06

Chilly Zhong


People also ask

Is XCFramework static or dynamic?

An XCFramework can be either static or dynamic and can include headers.

Where does the iPhone simulator store its data?

type: ~/Library/Application Support/iPhone Simulator.


1 Answers

Compile your library twice. Once using the device SDK, and again using the Simulator SDK.

Then use the lipo command line tool to create a "fat" library.

lipo -create libdevice.a libsimulator.a -output libcombined.a 

That should give you what you need.

like image 184
Jasarien Avatar answered Oct 16 '22 20:10

Jasarien