NSSound undeclared on iPhone?

3.1k Views Asked by At
sound = [[NSSound alloc] initWithContentsOfFile:@"staticbeam09.wav" byReference:YES];

Code referenced from Apple docs. Getting an error when I put this in viewDidLoad. If I put

NSSound *sound;

in the header file, I get the specifier-qualifier error at the top of my implementation file. What do I have to do to make this work? I was just pasting the code from Apple's documentation - has this been deprecated? Thanks for your help!

3

There are 3 best solutions below

9
On BEST ANSWER

http://icodeblog.com/2009/05/04/iphone-game-programming-tutorial-part-4-basic-game-audio/

that is how i did the audio bg music and sound effects at the end for iconquer

0
On

There is no NSSound class in iPhone SDK It's only for MacOS

4
On

Oxigen’s right. If you want to play sounds on iPhone, there are several options. Probably the easiest one is using Audio Services (example wrapper), then there is AVAudioPlayer and then you can also use OpenAL (I’ve written a very basic OpenAL sound effect engine called Finch). Depends on what you need to do.