Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make iPhone vibrate?

I am using this code buy getting compile errors for the audio line. Does anyone know why?

- (void)handleTimer:(NSTimer *)timer 
{
    self.counter--;
    self.timerLabel.text = [NSString stringWithFormat:@"%ld", self.counter];
    if (self.counter == 0)
    {
        AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
    }
}

1 Answers

You most likely forgot to import a framework for it

#import <AudioToolbox/AudioToolbox.h>
like image 111
Cyprian Avatar answered Jan 25 '26 09:01

Cyprian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!