IOHIDEventSystemCreate总是在iOS6的(在iOS5中,做工精细)返回NULL。 任何人都知道为什么吗?
实施例上iPhoneDevWiki
#include <IOKit/hid/IOHIDEventSystem.h>
#include <stdio.h>
void handle_event (void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event) {
// handle the events here.
printf("Received event of type %2d from service %p.\n", IOHIDEventGetType(event), service);
}
int main () {
// Create and open an event system.
IOHIDEventSystemRef system = IOHIDEventSystemCreate(NULL);
IOHIDEventSystemOpen(system, handle_event, NULL, NULL, NULL);
printf("HID Event system should now be running. Hit enter to quit any time.\n");
getchar();
IOHIDEventSystemClose(system, NULL);
CFRelease(system);
return 0;
}