tags:

views:

84

answers:

1

Im sure this is simple, but I have been googling for an hour and cannot find anything.

Basically I have a block of code that I want ignored on the simulator, but to run on the iphone.

self.musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
// assign a playback queue containing all media items on the device
[myPlayer setQueueWithQuery: [MPMediaQuery songsQuery]];

// start playing from the beginning of the queue
[myPlayer play];

I tried adding:

#if !SIMULATOR
#endif

around the code, but that did not work. Im sure there must be something simple that I am just not finding.

+3  A: 
#if defined(TARGET_IPHONE_SIMULATOR)

should do the trick.

slavikus
Perfect, just what I was looking for.
Zenox