Is it possible to use a static library only when testing with device and not simulator?

Yes, this can be done. I had a similar problem with a framework that caused linker errors only in the simulator so I setup up my project to only use the framework when building for a device.

The following assumes you are not using cocoa pods to link the library. I'm not sure what would need to be changed if you are.

  1. Select your target and go to the Build Phases tab.
  2. Under the "Link Binary With Libraries" section, remove the static library from the list but make sure the library file still exists in your project files under Frameworks folder. If the library file name is missing the leading "lib" in its name you might need to rename the file in the project navigator and add the leading "lib" to the file name.
  3. Go to the Build Settings tab.
  4. Find the "Other Linker Flags" setting.
  5. Double-click on the Debug value. Tap the + and enter "-l"
  6. In place of enter the actual name of your library minus the leading "lib". Do not include the extension. The "libMyLibrary.a" should be entered as "-lMyLibrary"
  7. Select the Debug value and notice a little circled +. Click the +.
  8. Click on the new "Any Architecture | Any SDK" part and change it to "Any iOS Simulator SDK".
  9. Now double click on the value to the right of "Any iOS Simulator SDK" and remove the -lsomeLibrary entry you added.

Now do a debug build.

The above change basically means that the library is linked in for all builds except for iOS Simulator builds.

You will probably also need to make some code changes. Any code making any reference to header files or other symbols from the library should be wrapped as follows:

#if !TARGET_IPHONE_SIMULATOR
#import "someLibrary.h"
#endif

#if !TARGET_IPHONE_SIMULATOR
    // Use stuff from the library
#endif