There are two seemingly similar functions that take a parameter kSystemSoundID_Vibrate:

1)AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);2)AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Both the functions vibrate the iPhone. But when you use the first function on devices that don’t support vibration, it plays a beep sound. The second function on the other hand does nothing on unsupported devices. So if you are going to vibrate the device continuously, as a alert, common sense says, use function 2.

See also "iPhone Tutorial: Better way to check capabilities of iOS devices" article.

First, add the AudioToolbox framework (AudioToolbox.framework) to your target in Build Phases.

Then, header file to import:

#import <AudioToolbox/AudioServices.h>
arrow
arrow
    全站熱搜

    pcwiki 發表在 痞客邦 留言(0) 人氣()