Skip to content

Instantly share code, notes, and snippets.

@emaalouf
Forked from Air-Craft/iphone_vibrate.m
Created June 4, 2016 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emaalouf/7b7a7a8685e718c4bc7a32bb27843942 to your computer and use it in GitHub Desktop.
Save emaalouf/7b7a7a8685e718c4bc7a32bb27843942 to your computer and use it in GitHub Desktop.
Short custom vibration on iPhone #ios #vibration #private-api
// Headers
#import <AudioToolbox/AudioToolbox.h>
void AudioServicesStopSystemSound(SystemSoundID inSystemSoundID);
void AudioServicesPlaySystemSoundWithVibration(SystemSoundID inSystemSoundID,id arg,NSDictionary* vibratePattern);
// Buzz code
NSArray *vibe = @[ @YES, @10 ]; // ON for 10ms
NSDictionary *dict = @{ @"Intensity": @0.1, @"VibePattern": vibe };
AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate,nil,dict);
// [self bk_performBlock:^(id obj) {
// AudioServicesStopSystemSound(kSystemSoundID_Vibrate);
// } afterDelay:1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment