+1  A: 

You need to compile your library for Intel so the Simulator can use it (which I gather you have done already), and then compile it for ARM, so it can run on the iPhone. Then you have to merge the two libraries. There are different ways to accomplish that, or make it more automatic.

Here are some links to help you:

http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html http://www.clintharris.net/2009/iphone-app-shared-libraries/

mahboudz
"6) Build your new static library for all the SDK targets (such as simulator, iPhone Device, etc.)." Of your first link is my problem. I don't know how to do that.
Ghommey
Your second link is about sth similar but not about static libarys. (Apart of the link to stormyprods blog)
Ghommey
Under the Project menu, what does your Active SDK say?
mahboudz
active sdk: `iPhone Device 3.1 (Base SDK)` active architecture: `armv6`
Ghommey
I don't think I have ever had any problems with this. I made a new project, selected Cocoa Touch Library and then built for device and simulator. ARM and i386. Here is another place to look: http://www.martijnthe.nl/2009/08/building-a-cross-platform-iphone-library-in-xcode/
mahboudz
+2  A: 

You need to add both .a files,the one built for the device (build/$config-iphoneos)and the one built for the sim (build/$config-iphonesimulator) to the new project. Make sure you name them differently before dropping them in. This is how admob and similar offering ship their static libs.

Elfred
I can't belive it - it works!
Ghommey
If you are so inclined, you can use lipo to merge both files into a universl binary
Elfred
A: 

I meet the same problem too. But seems you don't need to drag two .a file into the app project to solve this proplem. This is what I do: 1. Drag the static library project into app project's framework group 2. "Get Info" for the target in app project 3. Set the direct dependcy of static library 4. Make clean all unnecessary builds(for example the simulator build) in the static library project 5. Build in the app project

Rayman Zhang