Cyber Monday Sale 40% off unlimited courses & creative assets! 40% off unlimited assets! Save Now
  1. Code
  2. iOS SDK

iOS SDK Snippet: iPhone Vibration

Read Time:1 minLanguages:

With this iOS SDK code snippet, you will learn how to cause the iPhone to vibrate with the AudioToolbox framework and a single line of code. You will also learn additional details about iPhone vibration not explained in the code snippet itself, such as how to generate multiple vibrations at once. The source code referenced in this screencast was written by KevinBomberry and posted to Snipplr, an Envato site dedicated to saving and sharing code.

iPhone Vibration Notes

  • Vibration will not work on the iPodTouch or the iPad.
  • Calling this function on unsupported devices will do nothing and will not generate a run-time error.
  • The duration of each vibration is fixed to approximately 2 seconds in length and cannot be altered.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.