Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically detect if app is being run on device or simulator

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: http://volcore.limbicsoft.com/2009/09/iphone-os-31-gamekit-pt-1-woooohooo.html

like image 861
eugene Avatar asked Oct 01 '22 17:10

eugene


1 Answers

#if TARGET_OS_SIMULATOR

//Simulator

#else

// Device

#endif

Pls refer this previous SO question also What #defines are set up by Xcode when compiling for iPhone

like image 115
visakh7 Avatar answered Oct 08 '22 21:10

visakh7