small medium large xlarge

Back to: All Forums  Core Data
Generic-user-small
17 Apr 2009, 13:30
Duncan Groenewald (12 posts)

Hi, I just purchased this book and completed my version of the Recipes application which went OK.

Just a tip to the author - its tough to follow the instructions because they are not laid out in a step by step manner - and if you hit a problem its even tougher to figure out what went wrong and what step you have missed.

You might also consider adding in some step by step instructions for the first few UI components.

Anyway the real problem I want to solve is how to bind a NSTextView UI object to the Desc attribute so that I can store properly formatted text.

When I try and use it I get the following error:

Unacceptable type of value for attribute: property = “desc”; desired type = NSString; given type = NSConcreteAttributedString;

Any suggestion as to how I simply ignore this and force the string to be stored anyway ?

Thanks

Generic-user-small
18 Apr 2009, 19:45
Stephen Cremin (8 posts)

I just want to second Duncan’s point that “Chapter 2: Getting Started with Core Data” could be written more clearly in a step-by-step manner, ideally with more illustrations. I understand that this is not a book for Cocoa beginners, but there’s a great deal of new vocabulary (“content object”, “arranged objects”, etc) that is tied to a philosophy that has yet to be explained.

Generic-user-small
20 Apr 2009, 12:27
Duncan Groenewald (12 posts)

Mmm - ok maybe I should answer this myself now that I have figured it out…

It seems that one has to use a binary data field to store the formatted text and use the NSUnarchiveFromData value tranformer.

Of course this means it will be tough to do a text search on this field so I am planning to somehow figure out how to extract the plain text from the NSTextView and store this in a separate searchable string field in the database.

Now to figure out how to move nodes and leafs of a tree hierarchy around while also updating the underlying database to properly reflect these changes…and how to maintain the correct sequence in the hierarchy so every time the user opens it it remains in the order he left it in…

Profile_pragsmall
26 Apr 2009, 19:33
Robert Hoglund (1 post)

I also want to second Duncan’s point. Trying to follow along with chapter 2 is not something I would recommend to anyone. I also think that a step-by-step approach would have made trying to grok the basics much easier.

Generic-user-small
04 May 2009, 02:42
Jericho Hasselbush (3 posts)

Instead of trying to use formatted text for the NSTextView, just unselect the “Rich Text” checkbox in the object properties info window.

Avatarsmall_pragsmall
27 Jul 2009, 06:05
Marcus S. Zarra (284 posts)

A few thoughts on chapter two.

First, it has been cleaned up for the final release to make it a bit smoother. However the error you ran into was addressed in the chapter as it states to toggle the rich text setting. Perhaps the copy you were working from was before this change?

Second, the Core Data book is not targeted at developers first reaching into Objective-C and Cocoa. There are numerous concepts that are not discussed in this book because they are outside of the scope of the book. I suspect that the issues you are having fall into that category.

It is highly recommended that anyone who is just getting into Objective-C and Cocoa that they start with a book focusing on Objective-C and Cocoa before diving into a book focusing on one of the more complex APIs.

Cliff_pragsmall
03 Sep 2010, 15:08
Cliff White (2 posts)

Same problem here. I found my problem was not whether the ‘Rich Text’ field was toggled on or off (it was off) but, rather, my ‘Recipe.selection.desc’ binding was under an “Attributed String” section at the top of the bindings inspector window. It SHOULD have been under the ‘Value’ section immediately following the ‘Attributed String” section. In fact, the tool tip reveals just that. I’m beating myself for missing that. I hope this helps someone.

You must be logged in to comment