0

I've seen other answers on how to get the phone to vibrate, but I just can't get this thing to work. Can anyone help me?

My steps:

  1. Added the AudioToolbox framework (AudioToolbox.framework) to my target in Build Phases.
  2. #import AudioToolbox/AudioServices.h into my ViewController.h
  3. Added - (void)vibrate into my ViewController.h
  4. Added - (void)vibrate { AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); } into my ViewController.h under @implementation
  5. Called [self vibrate]; in my viewDidLoad.

What am I missing here?

I don't want to use an IBAction because this isn't supposed to vibrate off a button being pushed.

Hopefully you can help, and not just share links to other Stack Overflow questions/answers that I guarantee I already checked. I will post any extra code/info necessary.

Thanks!!

I do have my phone on. It is not on silent. And it is an iPhone5. enter image description here

Realinstomp
  • 532
  • 2
  • 13
  • 30
  • 1
    put a break point in your -(void)vibrate method to make sure it is being called – Mindeater Jun 28 '14 at 00:08
  • @Mindeater good tip. I just tried it though, and it was definitely being called. Any other advice? – Realinstomp Jun 28 '14 at 00:14
  • https://developer.apple.com/library/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/Reference/reference.html#//apple_ref/c/func/AudioServicesPlayAlertSound Says "Before using this function, call the AudioServicesCreateSystemSoundID function to obtain a system sound." – Mindeater Jun 28 '14 at 00:17
  • I'm seeing that documentation, but I believe its referring to something more complex than the quick system vibrate I'm using. Am I missing something? – Realinstomp Jun 28 '14 at 00:22
  • Create a new project with only the vibrate, would be my next step .. – Mindeater Jun 28 '14 at 00:23

1 Answers1

1

This should work. So it is likely that the vibration is disabled in your iphone sound settings.

If you are using an iPod touch, you should also be aware that this device doesn't have a vibration motor.

Khopa
  • 2,062
  • 1
  • 23
  • 22
  • Thanks for the answer! I'm using an iPhone5 to test on, and I just checked my settings and they look good to me? I added a screenshot to show, in case I'm missing something? – Realinstomp Jun 28 '14 at 00:03
  • No its not on silent mode. I actually turned silent mode on after I posted the picture just to make 100% sure it wasn't anything with that. Any other ideas? Thanks! – Realinstomp Jun 28 '14 at 00:15
  • They looks good to me too. Try to turn on the vibrate on silent, but apparently you are not in silent mode... so i don't know. Sorry. Good luck solving that. – Khopa Jun 28 '14 at 00:16