Re: non-NSString values in model user info via xcode UI
Re: non-NSString values in model user info via xcode UI
- Subject: Re: non-NSString values in model user info via xcode UI
- From: Quincey Morris <email@hidden>
- Date: Thu, 20 Jan 2011 12:26:46 -0800
On Jan 20, 2011, at 11:57, Mikkel Eide Eriksen wrote:
> I have a Core Data model and I'd like to add some metadata about the entities/attributes/relationships. In most cases, strings are fine, but I'd also like to record arrays or even sub-dictionaries. This will reduce the amount of code in my app by a fair deal.
>
> As far as I can tell, the XCode UI only allows values added to the user info dictionary to be strings. I suppose I could use a delimted string and do [[userdict valueForKey:@"key"] componentsSeparatedByString:@"delimiter"]] wherever I access it to get an array, but since the goal is reducing the amount of code, this seems counterproductive.
>
> Any suggestions?
I don't see any way to get a non-string value into the dictionary via the data model window either, though there doesn't seem to be any inherent restriction on the user info dictionary generally.
One way might be to put the information in a separate plist file, and set the entity's "userInfo" property programmatically. It looks like you'd have to be sure to do that before the model is actually used to access the data.
Or, you might be able to use a regular attribute instead of user info, using the "transformable" type to get its value archived. That doesn't solve your UI problem, of course, but might be part of a solution if nothing else works.
_______________________________________________
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