In the documentation of AudioServicesPlayAlertSound, it says I can disable vibration when playing a sound:
iPhone—plays the specified sound. If the user has configured the Settings application for vibration on ring, also invokes vibration. However, the device does not vibrate if your app’s audio session is configured with the AVAudioSessionCategoryPlayAndRecord or AVAudioSessionCategoryRecord audio session category.
However, I still feel vibration on my iPhone 4S (iOS 5.1.1) even after setting my category to "play and record". It rings and vibrates at the same time.
#import <AudioToolbox/AudioServices.h>
#import <AVFoundation/AVAudioSession.h>
NSError* error;
[[AVAudioSession sharedInstance]
setCategory:AVAudioSessionCategoryPlayAndRecord
error:&error];
if (error == nil) {
AudioServicesPlayAlertSound(1000);
}
I've also tried AudioServicesPlaySystemSound, but the results are the same. The reason why I want to disable vibration is because I am making an app where the user must place her phone far away and the phone should not topple over due to vibration.
AudioServicesPlaySystemSound. It has the same problem of vibrating on certain sound ID's such as 1000 (email received sound effect). - JoJokSystemSoundID_Vibrate. How did you come up with '1000' as a legitimate thing to passAudioServicesPlaySystemSound()? (It works for me also, but this seems fragile.) It seems possible that Apple hard-codes the vibration into special sounds. Since these are private sounds, it seems reasonable that Apple would not need them to follow the documentation you quoted above. - Jon Brooks