все
У меня есть NSTableView, а также три NSTextFields, отображаемые внутри NSWindow. (в ИБ).
Сущность спроектирована так:
Entity: Data
Attributes:
Title String
URL String
UserName String
Password String
Я успешно связал NSArrayController с managedObjectContext, а NSTableView - с атрибутом Title массива Controller, а NSTableView может правильно отображать все заголовки.
Я хочу реализовать следующую задачу:
When user click one of the row in the NSTableView, the rest of the three NSTextFields can show the records of that row, respectively URL< username and password.
, поэтому я делаю следующее для части URL
привязка NSTextField к выделению NSArrayController.URL
Когда я запускаю программу, она выдает ошибки, однако, если я сниму флажок «Поднимает для неприменимых ключей» в свойстве привязки, программа может быть успешно запущена, и значение может быть корректно показано в тексте. поле. Кто-нибудь может объяснить, почему?
ошибка говорит:
[<NSTableView 0x102240d60> valueForUndefinedKey:]: this class is not key value coding-compliant for the key URL.
Вот часть журнала ошибок:
2012-01-17 11:52:57.533 Quills[98683:407] An uncaught exception was raised 2012-01-17 11:52:57.534 Quills[98683:407] [<NSTableView 0x102240d60> valueForUndefinedKey:]: this class is not key value coding-compliant for the key URL. 2012-01-17 11:52:57.540 Quills[98683:407] ( 0 CoreFoundation 0x00007fff8abd2286 __exceptionPreprocess + 198 1 libobjc.A.dylib 0x00007fff8d84cd5e objc_exception_throw + 43 2 CoreFoundation 0x00007fff8ac5c4c9 -[NSException raise] + 9 3 Foundation 0x00007fff8d1e8783 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:]
+ 240 4 Foundation 0x00007fff8d11f462 _NSGetUsingKeyValueGetter + 108 5 Foundation 0x00007fff8d11f3e9 -[NSObject(NSKeyValueCoding) valueForKey:] + 392 6 Foundation 0x00007fff8d13ee76
-[NSObject(NSKeyValueCoding) valueForKeyPath:] + 348 7 AppKit 0x00007fff85ab33f1 -[NSArrayController
_multipleValueForKeyPath:atIndex:] + 84 8 AppKit 0x00007fff85ab24e5 -[NSArrayController _singleValueForKeyPath:] + 151 9 AppKit 0x00007fff8581909a
-[_NSControllerObjectProxy valueForKeyPath:] + 77 10 Foundation 0x00007fff8d13ee39 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 287 11 AppKit 0x00007fff85818f46
-[NSBinder _valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:] + 654 12 AppKit 0x00007fff85818c30 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 171 13 AppKit 0x00007fff85a1cc92 -[NSValueBinder
_referenceBindingValue] + 31 14 AppKit 0x00007fff85a1caa3 -[NSValueBinder
_adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState:]
+ 647 15 AppKit 0x00007fff85a1c788 -[NSValueBinder _observeValueForKeyPath:ofObject:context:] + 303 16 AppKit 0x00007fff85a345af
-[NSTextValueBinder _observeValueForKeyPath:ofObject:context:] + 43 17 AppKit 0x00007fff8580abdb
-[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591