Re: Detecting iOS and Mac OS X when running unit tests
Re: Detecting iOS and Mac OS X when running unit tests
- Subject: Re: Detecting iOS and Mac OS X when running unit tests
- From: Fritz Anderson <email@hidden>
- Date: Sun, 08 Apr 2012 15:20:51 -0500
On 8 Apr 2012, at 2:50 PM, Tito Ciuro wrote: I'm not sure whether I should post this question on the Cocoa or Xcode list. I'll try here since it has to do with unit tests: when I'm running a unit test, I need to detect whether I'm running on the Mac or on the simulator. Something like:
- (void)testFoo { if (<RUNNING_ON_MAC> || <RUNNING_ON_SIMULATOR>) { // Do something... } else { // Do something else... } }
At compile time I could use TARGET_IPHONE_SIMULATOR and TARGET_OS_MAC, but at runtime I'm not getting it right. I'm curious why you feel you need to do the check at runtime. The code will be running on those platforms if and only if it has been compiled for them. Your if()...else might as well be #if...#else...#endif, right?
— F
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden