Alerts

Audio Services provides a vibration/sound mashup called an alert sound, which you invoke as follows:

AudioServicesPlayAlertSound(mySound);

This call, which is also demonstrated in Recipe 3-7, plays the requested sound and, possibly, vibrates or plays an additional alert. On iPhones, when the user has set Settings > Sounds > Vibrate on Ring, it vibrates the phone. This vibration provides a tactile response to the user even if the sound volume is low or muted by the user, obscuring the audio portion of the alert.

iPad units and second-generation and later iPod touch units play the sound sans vibration (because it is unavailable on those units) through the onboard speaker. First-generation iPod touches (see if ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.