Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2 errors when calling AudioServicesPlaySystemSound?

I'm making an app which vibrates once a timer reaches a certain limit.

However, when calling

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Xcode comes up with two errors:

Undefined symbols for architecture i386:
  "_AudioServicesPlaySystemSound", referenced from:
      -[drawGraph drawRect:] in drawGraph.o
ld: symbol(s) not found for architecture i386

and

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas on what is causing these errors?

like image 709
n30ncitylights Avatar asked Nov 27 '22 14:11

n30ncitylights


1 Answers

enter image description here

If you simply must not add the header files only, as shown above, a framework must be added to your project. and you should a following header. #import <AudioToolbox/AudioToolbox.h>

  1. In Xcode, click your project file at the top of the Project Navigator.

  2. Click 'YourProjectName' under "Targets"

  3. Click the "Build Phases" tab.

  4. Click the plus in the "Link Binary With Libraries" window.

  5. Add the AudioToolbox.Framework library

  6. Add #import <AudioToolbox/AudioToolbox.h>

enter image description here

like image 69
bitmapdata.com Avatar answered Dec 07 '22 00:12

bitmapdata.com