1

I have 2 versions of some library, one - for real device, other - for simulator. Can I write sh script to detect on which device (device/sim) Xcode will run application and switch that libraries in Run Script phase?

zzheads
  • 1,368
  • 5
  • 28
  • 57

1 Answers1

2

When your script executed list of environment variables available. One of them is __IS_NOT_SIMULATOR.

When building for simulator it have this value:

export __IS_NOT_SIMULATOR\=NO

When building for device it have this value:

export __IS_NOT_SIMULATOR\=YES

In build script it can be accessed like this:

echo "IS_NOT_SIMULATOR = ${__IS_NOT_SIMULATOR}"
Ramis
  • 13,985
  • 7
  • 81
  • 100