Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you map attribute names using MagicalRecord?

I have an NSManagedObjectModel subclass, and it has this property:

userId

However, the downloaded XML, which is parsed into an NSDictionary to be mapped to my model, uses this property:

userid

(Note the difference in case)

I tried following this blog post, yet I'm still doing something wrong (because the data doesn't map correctly):

http://www.cimgf.com/2012/05/29/importing-data-made-easy/

Here's a screenshot showing how I setup the model in the data model builder:

Screen Shot, MagicalRecord

What's the correct way to do this?

like image 305
JRG-Developer Avatar asked Dec 07 '25 02:12

JRG-Developer


1 Answers

Here's the correct way to do this:

On the attribute set this:

name = userId

On the attribute's User Info set these:

key = mappedKeyName
value = userid

Here's how it should look:

MagicalRecord Mapping Setup

like image 177
JRG-Developer Avatar answered Dec 08 '25 18:12

JRG-Developer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!