gpt4 book ai didi

objective-c - 为什么 Xcode 中出现这些错误意味着什么?

转载 作者:行者123 更新时间:2023-12-03 16:53:30 24 4
gpt4 key购买 nike

2009-07-06 06:49:13.666 Spark[9825:10b] -[<NSUserDefaultsController 0x137af0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key hotKeyDisplayEntry.

2009-07-06 06:49:13.667 Spark[9825:10b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSUserDefaultsController 0x137af0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key hotKeyDisplayEntry.'

编辑:我认为是什么导致了这个问题。

OSStatus MyHotKeyHandler(EventHandlerCallRef nextHandler,EventRef theEvent,void *userData)
{
EventHotKeyID hkCom;
GetEventParameter(theEvent,kEventParamDirectObject,typeEventHotKeyID,NULL,sizeof(hkCom),NULL,&hkCom);
HotKeyController *controller = (HotKeyController *)userData;
int l = hkCom.id;
switch (l) {
case 1: [controller->window makeKeyAndOrderFront:NSApp];
break;
case 2: [controller->searchWindow makeKeyAndOrderFront:nil];
break;
case 3: [controller->entryWindow makeKeyAndOrderFront:nil];
break;
}
return noErr;
}

- (void)awakeFromNib
{
//Register the Hotkeys
EventHotKeyRef gMyHotKeyRef;
EventHotKeyID gMyHotKeyID;
EventTypeSpec eventType;
eventType.eventClass=kEventClassKeyboard;
eventType.eventKind=kEventHotKeyPressed;


InstallApplicationEventHandler(&MyHotKeyHandler,1,&eventType,(void *)self,NULL);

gMyHotKeyID.signature='htk1';
gMyHotKeyID.id=1;
if([[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyCodeMain"]!=-999) {
RegisterEventHotKey([[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyCodeMain"], [[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyModifiersMain"], gMyHotKeyID, GetApplicationEventTarget(), 0, &gMyHotKeyRef);
}

gMyHotKeyID.signature='htk2';
gMyHotKeyID.id=2;
if([[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyCodeSearch"]!=-999) {
RegisterEventHotKey([[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyCodeSearch"], [[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyModifiersSearch"], gMyHotKeyID, GetApplicationEventTarget(), 0, &gMyHotKeyRef);
}

gMyHotKeyID.signature='htk3';
gMyHotKeyID.id=3;
if([[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyCodeEntry"]!=-999) {
RegisterEventHotKey([[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyCodeEntry"], [[NSUserDefaults standardUserDefaults] integerForKey:@"hotkeyModifiersEntry"], gMyHotKeyID, GetApplicationEventTarget(), 0, &gMyHotKeyRef);
}

}

在 NIB 中,我还将一个文本字段连接到 NSDefaultsController。

最佳答案

一般来说,这意味着您正在尝试访问某个对象的名为 hotKeyDisplayEntry 的键,但该对象没有这样的键。您可能犯了一个拼写错误或轻微的逻辑错误。

关于objective-c - 为什么 Xcode 中出现这些错误意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1085596/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com