6.6. Vibrating

You may also be interested in how to make a racket without playing any sound; that is, how to cause the iPhone to vibrate. Depending on whether the iPhone's owner has his device placed on a conference room table, vibrating can create a variety of different nuisance sounds to get the user's attention. The audio service described at the beginning of this chapter has a nifty little constant sound identifier that you can use to accomplish this. Example 6-11 shows you how.

Example 6-11. Vibrating sample code
#import <AudioToolbox/AudioToolbox.h>
#import <UIKit/UIKit.h>

- (void)vibrate
{
    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}