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: Mikkel Eide Eriksen <email@hidden>
- Date: Thu, 20 Jan 2011 21:53:29 +0100
Hi Quincey
Thanks for the speedy reply. I'll look into having the root entity either parse from a plist or something similar.
Hmm, it just occured to me that I can put json strings in the user info, and parse them back into the user info. That would enable me to put complex nested dictionaries & arrays in there via the UI.
Mikkel
On 20/01/2011, at 21.26, Quincey Morris wrote:
> 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.
>
>
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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