How to Make the iPhone Vibrate

December 15th, 2009 by Derek van Vliet Leave a reply »

The iPhone is capable of dazzling the user eyes by pushing impressive graphics around its screen and tickling their ears with a lot of audio to go with it, but you may want to give users of your iPhone app some additional sensory experience on top of that. You can do this by making the device vibrate.

We actually use the Audio framework to vibrate device. Here is how to do it in 3 simple steps:

1. Add the AudioToolbox framework to your target.

2. In the file you intend to trigger a vibration, import the AudioToolbox header file:

#import <AudioToolbox/AudioToolbox.h>

3. Finally, call the following line to make the device vibrate:

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

blog comments powered by Disqus