iosxcodestatic-libraries

iOS: Unlink library


There is a library that causes build errors when the project builds for the simulator.

Is there a way to set a flag in the build settings or somewhere else to make the compiler NOT link the specific library when building for the simulator?

This could be done by creating a new Target, but I would prefer not having to create a whole new target.

What would be the most convenient solution for something like this? (which works both in XCode 4 and 5)


Solution

  • You can #ifdef out the #import calls to the library using:

    #ifdef TARGET_IPHONE_SIMULATOR
    #import <...>
    #endif
    

    If you do that then the code won't try to link with the library.