简体   繁体   中英

Why am I getting these Errors in the Console when Debugging in XCode?

I am creating an App and when I run it I check the Debug Pane, I am getting these errors Inside the Console:

2009-05-27 07:18:03.852 Spark[1228:10b] [ valueForUndefinedKey:]: the entity Projects is not key value coding-compliant for the key notes.

2009-05-27 07:18:09.029 Spark[1228:10b] Error setting value for key path selectionIndexPaths of object [entity: Projects] (from bound object with object ID 726 in Nib named MainMenu.nib): [ valueForUndefinedKey:]: the entity Projects is not key value coding-compliant for the key notes.

It only happens when I bind a text fields value to the NSTreeController's selection and Controller Key 'Notes', I also notice that when I try and edit the text field in the App the Outline View freezes(this is when the above error shows in console). How can I fix this Have I not binded the Text Field correctly, here is a picture of the Bindings for the text field: http://snapplr.com/840y

Entity Diagram

http://snapplr.com/vqc9

The NEW Error

**2009-05-27 18:37:41.661 Spark[3957:10b] Unacceptable type of value for attribute: property = "notes"; desired type = NSString; given type = NSConcreteAttributedString; value = Alpha Nine Zeta{
    NSColor = NSNamedColorSpace System textColor;
    NSFont = "MarkerFelt-Thin 16.00 pt. P [] (0x001a7190) fobj=0x00146ef0, spc=4.00";
    NSOriginalFont = "MarkerFelt-Thin 16.00 pt. P [] (0x001a7190) fobj=0x00146ef0, spc=4.00";
    NSParagraphStyle = Alignment 3, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (
    28L,
    56L,
    84L,
    112L,
    140L,
    168L,
    196L,
    224L,
    252L,
    280L,
    308L,
    336L
), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor 0.05, HeaderLevel 0;
}.**

If a project is selected in your outline view, the text field tries to get the value notes from the 'selected' treecontroller item, which is a project. Since a Projects entity has no notes attribute, the KVO throws an exception.

Deselect the binding option 'Raises for Not Applicable Keys' in the 'value' binding of the text field.

You've bound the text field to a Projects's notes, but in your model, only Taskses have notes. If you meant for Projectses to have notes, you need to add that property to the Projects entity; if you meant to bind to the Taskses, then you need to change the model key path, probably to children.notes .

(Related: Those entity names should really be singular.)

As for the new error: Text fields can't display styled text, only plain text. Make a text view instead.

Second Error:

In the Text Field's attributes, do you have the Rich Text option selected? it looks like it is sending an NSAttributedString to the the Notes property, which expects an NSString.

Turn this option off if it is set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM