ios上的可执行程序怎么看到执行效果

**在http://www.iphonedevwiki.net/index.php/IOHIDFamily上看到这样一段代码,不知道要怎么才能看到main函数的执行效果。**********getchar printf都是c语言的函数,ios又没有键盘,怎么个getchar法呢,迷惑中。。。@snakeninny


Example#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;
    }

**

你先把帖子格式好好编辑下吧,现在这格式把我看瞎了

格式发上去不知道怎么就乱了。:lol:

你要实现什么功能?在后台截取系统要关事件?还是?

拦截事件,实现我自己的功能。

IOHIDEventSystemRef system = IOHIDEventSystemCreate(NULL);创建的对象为空,网上说ios5可以用,ios6 ios7为什么创建是空呢?

Problems with iOS >= 6.1 (or even earlier)

Since at least iOS 6.1 there is a check in the function IOHIDEventSystemCreate that compares the bundle identifier with “com.apple.springboard”. If that check fails, the function will return NULL. Therefore you can no longer use the HID system in apps unless you circumvent this check.有没有方法绕过检查呢?

具体的方法可能需要你自己逆向找了