Carbon事件處理在OS X 10.11 El Capitan中仍然有效嗎?Carbon事件處理是否仍在El Capitan工作?
EventTypeSpec OPNEventType[3];
OPNEventType[0].eventClass = getEventClass();
OPNEventType[0].eventKind = getEventKindInsert();
OPNEventType[1].eventClass = getEventClass();
OPNEventType[1].eventKind = getEventKindRemove();
OPNEventType[2].eventClass = getEventClass();
OPNEventType[2].eventKind = getEventKindDataAvailable();
handlerUPP = NewEventHandlerUPP(CBOpticonHandler);
// create the OPN interface, which is passed to our event handler
interface = CreateOPNInterface();
OSStatus status = InstallApplicationEventHandler(handlerUPP, 3, OPNEventType, interface, NULL);
if (status != noErr) {
NSLog(@"%s: InstallApplicationEventHandler failed!", __PRETTY_FUNCTION__);
[self stop];
return;
}
此代碼在升級OS X後似乎無法工作。有什麼可以替代的?
它以什麼方式不起作用?安裝處理程序時是否出現錯誤?如果是這樣,有什麼錯誤?還是你的處理程序從未被調用過?什麼是你正在嘗試處理的實際事件類,種類對?你確定那些正在發生?您是否嘗試過[事件追蹤](https://developer.apple.com/library/mac/technotes/tn2124/_index.html#//apple_ref/doc/uid/DTS10003391-CH1-SECHLTBEVENTTRACE)? –
@KenThomases處理程序永遠不會被調用。事件類:OPTI eventKind:1。這是一款OPTICON OPN 2001條碼掃描器。由於運行gdb時出現了一些問題(我猜測應用程序簽名),因此我無法追蹤這些事件。 – aneuryzm
我懷疑El Capitan不再支持這款舊掃描儀。但我想證明這一點。 – aneuryzm