ios - RestKit 0.20 Posting object's attributes on conditional basis -
I handle complex JSON data in bulk quantities; Customize traffic. To say for simplicity that I am following user class: and mapping of my attributes is low: For signin call, just send me the username & amp; Need to post; The following JSON as the password: While for the signup call, I have to post the whole user object so that the mapping mapping dictionary can be reduced. I need to apply this process to a very complex JSON. I need an object How can I send attributes in a favorable fashion in a POST call on conditional basis? Thank you.
@property (nonatomic, retain) NSString * email; @property (nontomic, write) NSString * fname; @property (nonatomic, retain) NSString * password; @protecti (nanatomic, retten) nssting * profiles; @protecti (nontomic, retten) nssting * snm; @property (nonatomic, retain) NSString * status; @property (non-constructive, retaining) NSString * tokens; @property (nonatomic, retain) NSString * Username; @protecti (nonatomic, intact) NSNumber * huggine in; @protecti (nontomic, raten) NSDT * Detroit;
[dic addEntriesFromDictionary: @ {@ "fname": @ "fname", @ "snom" @ "Password", @ "password", @ "status": @ "profile": @ "profile", @ "email": @ "email", @ "user name": @ "user name", @ "password": @ "Status", @ "token": @ "token", @ "opened in in": @ "isglined", @ "debt crated": @ "debt crated"};
{"user": {"password": "password", "username": "demouser"}}
You are free to create multiple mappings for the same class / organization type - there is no restriction Each mapping is associated with other mapping / request descriptor / feedback descriptor and it requires you to focus on identity and specificity.
This may be easiest for mapping a request for you in which all the attributes, and whose class is NSDictionary
. After this, use this mapping for a request that you use KVC ( for Dictionary with Dictionary:
), to remove the key of interest from one of your true source objects in a dictionary So that you can supply the object manager for mapping and transmission
Comments
Post a Comment