• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTextView data bindings losing info when saving to core data.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView data bindings losing info when saving to core data.


  • Subject: NSTextView data bindings losing info when saving to core data.
  • From: Mathieu Tozer <email@hidden>
  • Date: Fri, 7 Dec 2007 13:06:23 -0200

While Core Data issues are being brought up (http://www.cocoabuilder.com/archive/message/cocoa/2007/11/2/192065 ) , I'd like to ask about something that's been bugging me.

In tiger I would often bind the data or attributedString value from a NSTextView to some Core Data object in an NSArrayController, and it worked without a hitch. In Leopard, however, when I do the same thing, and hit save after entering text into the text box, the string value is reverted to the value from before the change.

"Rather unpleasant" as well if you have written quite a long string!

It works as expected when you enter the string, and then quit. The string is stored and saved to the persistent store.

If you don't hit save but just change the selection in the array controller, the text view stores the string in the bound object properly, and then you are free to hit save. There's possibly a reason for this change in Leopard, but I don't understand it!

I thought there might be some extra configuration, so I checked the Continuously Updates Value box in the TextBox, but running the app with this blows up

2007-12-07 12:55:16.289 TextBoxBug[11494:10b] Cannot create NSData from object of class NSCFString
2007-12-07 12:55:16.291 TextBoxBug[11494:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot create NSData from object of class NSCFString'


This checkbox is certainly under the data binding (as you can see in the demonstration app attached to this post), but it looks as though with the option checked the binding is forgetting to turn the string into data?

So I think, well that's not it, and uncheck the box again, but it still blows up. The only way I can get it to work again is if I delete the whole TextView, add a new one, and rebind it, and then I'm back to square one.

What should I be doing?

Here is the app "TextBoxBug"
http://www.mathieutozer.com/TextBoxBug.zip

- Mathieu Tozer
plasq.com
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Strange bindings error
  • Next by Date: Removing layer-backed NSViews
  • Previous by thread: Strange bindings error
  • Next by thread: Removing layer-backed NSViews
  • Index(es):
    • Date
    • Thread