Yes, this is something that has caused AppStore rejections in the past, and probably will again...which means it is still possible to do it.
Answering my own question, here's how to do it:
Add framework CoreTelephony in Build Phases.
declare:
extern void * _CTServerConnectionCreate(CFAllocatorRef, int (*)(void *, CFStringRef, CFDictionaryRef, void *), int *);
extern int _CTServerConnectionSetVibratorState(int *, void *, int, int, float, float, float);
static void* connection = nil;
static int x = 0;
initialize:
connection = _CTServerConnectionCreate(kCFAllocatorDefault, &vibratecallback, &x);
start vibration:
_CTServerConnectionSetVibratorState(&x, connection, 3, intensity, 0, 0, 0);
stop vibration:
_CTServerConnectionSetVibratorState(&x, connection, 0, 0, 0, 0, 0);
This code is from HapticKeyboard, a downloadable application that buzzes the phone as you type. It is available for jailbroken phones on Cydia. See also my jailbreaking experience)
Any other good references?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…