IOHIDEventSystemCreate on iOS6 failed

家住魔仙堡 提交于 2019-12-01 00:06:38

Yes, it doesn't work on iOS6 for me too. I now use this:

void *system = IOHIDEventSystemClientCreate(kCFAllocatorDefault);
IOHIDEventSystemClientScheduleWithRunLoop(system, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
IOHIDEventSystemClientRegisterEventCallback(system, handle_event, NULL, NULL);
CFRunLoopRun();

But I don't know why it only reports multitouch+keyboard events. SpringBoard in iOS6 calls this:

IOHIDEventSystemClientSetMatchingMultiple(system, array);

with an array containing PrimaryUsagePage + PrimaryUsage, but I can't get it working... If someone knows a solution for getting accelerometer events for example, I'm interested too.

you can change headers like #include "IOHIDEventSystem.h" when you drag IOKit.framework to your project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!