程序出现AssertMacros: queueEntry, file: /SourceCache/IOKitUser/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512的解决办法

出现AssertMacros: queueEntry, file: /SourceCache/IOKitUser/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512时,
修改main.m,添加如下代码

typedef int (*PYStdWriter)(void *, const char *, int);
static PYStdWriter _oldStdWrite;

int __pyStderrWrite(void *inFD, const char *buffer, int size)
{
        if ( strncmp(buffer, "AssertMacros:", 13) == 0 ) {
                return 0;
        }
        return _oldStdWrite(inFD, buffer, size);
}

然后在main()中的
@autoreleasepool
前添加
    _oldStdWrite = stderr->_write;
    stderr->_write = __pyStderrWrite;

This passage is moved from ra1ndrops.com. I will not longer use that domain, so I import it here.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 × four =