Skip to content

Instantly share code, notes, and snippets.

@daehn
Created April 3, 2015 11:04
Show Gist options
  • Save daehn/6bcecbadb9c77011935b to your computer and use it in GitHub Desktop.
Save daehn/6bcecbadb9c77011935b to your computer and use it in GitHub Desktop.
Custom iOS vibration pattern with 100ms duration using private API
NSMutableDictionary *vibrationParameters = [[NSMutableDictionary alloc] init];
vibrationParameters[@"VibePattern"] = @[@YES, @100];
vibrationParameters[@"Intensity"] = @1;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
AudioServicesStopSystemSound(kSystemSoundID_Vibrate);
AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate, nil, vibrationParameters);
#pragma clang diagnostic pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment