37

Possible Duplicate:
Making the iPhone vibrate

How can you programmatically make the iPhone vibrate?

Any ideas, or tutorial links appreciated.

Community
  • 1
  • 1
Sam Jarman
  • 7,277
  • 15
  • 55
  • 100
  • 1
    lots of good stuff already on stackOverflow too: http://stackoverflow.com/search?q=iphone+vibrate – D.C. Jan 31 '11 at 16:34

2 Answers2

91

You can use

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 

Note that you need to add the AudioToolbox framework and import the following header file:

#import <AudioToolbox/AudioServices.h>
Kevin Chen
  • 994
  • 8
  • 24
Henrik P. Hessel
  • 36,243
  • 17
  • 80
  • 100
4

To clarify the add(ing) the AudioToolbox framework portion of this answer:

  1. click the project from Project Navigator
  2. click the target from the left-hand navigator
  3. click Build Phases section at the top
  4. expand the Link Binary With Libraries section
  5. click little + (plus) sign
  6. type AudioToolbox.framework
  7. click Add
NathanChristie
  • 2,374
  • 21
  • 20