0

When I implement sounds in my apps, I always ge a couple of yellow warning triangles with the warning:

"implicit declaration of function "audio services create system soundID" is invalid in C99"

It doesn't effect anything in my app I just wondered if it's something in my code and something I should be addressing?

CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"btnclick", CFSTR 
                                        ("mp3"), NULL);
                                        UInt32 soundID;
                                        AudioServicesCreateSystemSoundID (soundFileURLRef, &soundID);
                                        AudioServicesPlaySystemSound (soundID);
Cœur
  • 37,241
  • 25
  • 195
  • 267
JSA986
  • 5,870
  • 9
  • 45
  • 91

1 Answers1

5

The compiler isn't finding declarations of the AudioServices functions and is complaining about that.

The documentation for those functions says which framework they come from, so an import...

#import <AudioToolbox/AudioToolbox.h>

...should get rid of the warnings.

Phillip Mills
  • 30,888
  • 4
  • 42
  • 57