2

Is there any code which can make my app smooth vibrate when i used to press the button. Currently i am using the following methods. Please have a look

-(IBAction)buttonClicked:(UIButton *)sender
{
     //AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
  AudioServicesPlayAlertSound (1105);
  self.view.userInteractionEnabled = NO;

   [[HelperClass shared]playSound:@"single_click_12"];
[HelperClass showBounceAnimatedButton:sender completionBlock:^{
    self.view.userInteractionEnabled = YES;
    selectedIndex =(int) sender.tag;
    [self performSelector:@selector(pushTheViewToGame) withObject:nil afterDelay:0.6];
}];

 // NSLog(@"Sender Tag :%li",(long)sender.tag);
}
PAn Kaj Khatri
  • 539
  • 1
  • 6
  • 22

1 Answers1

1

The device will not vibrate even if it is enabled.

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

My method was called at a specific time in the measurement of the devices movements. I had to stop the recording and then restart it after the vibration had occurred.

It looked like this.

-(void)vibrate {
    [recorder stop];
    AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
    [recorder start];
    // recorder is an AVRecorder instance.

}
Bhupesh Kumar
  • 369
  • 2
  • 18