6

How can I exclude libraries which I have compiled only for the iOS device architecture (libssh2, etc.) from an Xcode project when I am compiling the app to run on the simulator?

titaniumdecoy
  • 18,900
  • 17
  • 96
  • 133
  • why not compiling them also for i386 and create a universal "binary" with "lipo"? Then you can also test libss2, etc. on simulator. Do you need help on that? – Jonas Schnelli Apr 19 '12 at 12:33

1 Answers1

2

I know this is an old question, but if someone's still looking for the answer, you can use Weak Linking to specify that certain libraries are optional.

See this answer for how to define a weak/optional link in XCode 4

Then, in the code that would normally use the features, you can detect that you're in the simulator at compile time with

#if TARGET_IPHONE_SIMULATOR

  NSLog(@"I'm in the simulator");

#endif

or at run time by inspecting the value of

  [[UIDevice currentDevice] model]

and programmatically avoid using the libraries that don't exist in the simulator environment.

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207