10

Wondering what code in objective-c should I use to shake the iPhone continuously...

Daniel Vassallo
  • 337,827
  • 72
  • 505
  • 443
geejay
  • 5,440
  • 8
  • 50
  • 60

3 Answers3

4

You may want to use the code from "How do you make the iPhone vibrate for arbitrary durations?":

extern void * _CTServerConnectionCreate( CFAllocatorRef, int (*)(void *, CFStringRef, CFDictionaryRef, void *), int *);
extern int _CTServerConnectionSetVibratorState(int *, void *, int, int, float, float, float);

// Initialize
connection = _CTServerConnectionCreate(kCFAllocatorDefault, &vibratecallback, &x);

// Start Vibration
_CTServerConnectionSetVibratorState(&x, connection, 3, intensity, 0, 0, 0);

// End Vibration
_CTServerConnectionSetVibratorState(&x, connection, 0, 0, 0, 0, 0);

I bet this will make it quite difficult for your application to get approved for AppStore! Check out the Unofficial App Store Rejection Criteria.

Community
  • 1
  • 1
Daniel Vassallo
  • 337,827
  • 72
  • 505
  • 443
0

I disagree iOS 5 has implemented Custom Vibrations mode. So in some cases variable vibration is acceptable. The only thing is unknown what library deals with that (pretty sure not CoreTelephony.framework) and if it is open for developers.

Nikolay Frick
  • 2,145
  • 22
  • 17
-3

Don't do this. Besides the fact it could get you rejected, it's simply bad form.

Ken Wootton
  • 1,100
  • 1
  • 10
  • 19