Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude frameworks in simulator builds in Xcode

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?

like image 878
titaniumdecoy Avatar asked Nov 15 '22 06:11

titaniumdecoy


1 Answers

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.

like image 52
Nate Avatar answered Dec 21 '22 07:12

Nate