NSSound Not Announced On iPhone?

sound = [[NSSound alloc] initWithContentsOfFile:@"staticbeam09.wav" byReference:YES];

      

Code referenced in Apple Docs . Getting error when I put this in viewDidLoad. If I put

NSSound *sound;

      

in the header file, I am getting a specifier-classifier error at the top of my implementation file. What do I need to do to make this work? I was just pasting the code from Apple documentation - was it deprecated? Thank you for your help!

+2


source to share


3 answers


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



this is how i made audio bg music and sound effects at the end for iconquer

0


source


IPhone SDK does not have NSSound class This is only for macOS



+4


source


Oxygenes are right. If you want to play sounds on iPhone, there are several options. Probably the easiest one is to use Audio Services ( shell example ) then there is AVAudioPlayer and then you can also use OpenAL (Ive wrote a very simple OpenAL sound effect engine called Finch ). Depends on what you need to do.

+3


source







All Articles