Programmatically detect if app is being run on device or simulator

前端 未结 8 1917
我寻月下人不归
我寻月下人不归 2020-11-28 06:14

I\'d like to know whether my app is being run on device or simulator at run time. Is there a way to detect this?

Reason being to test bluetooth api with simulator:

8条回答
  •  不知归路
    2020-11-28 06:46

    You can use the TARGET_IPHONE_SIMULATOR preprocessor macro to distinguish between device and simulator targets.

提交回复
热议问题