restkit

Foreign key relationship mapping with RestKit

假如想象 提交于 2019-12-25 03:24:56
问题 I'm totally new to RestKit and am struggling somewhat. JSON: { "teams": [ { "id": 1, "name": "Team A" }, { "id": 2, "name": "Team B" } ], "users": [ { "id": 1, "name": "cameron", "teamId": 1 }, { "id": 2, "name": "paul", "teamId": 2 } ] } CoreData: @interface Team : NSManagedObject @property (nonatomic, retain) NSNumber * teamId; @property (nonatomic, retain) NSString * name; @end @interface User : NSManagedObject @property (nonatomic, retain) NSNumber * userId; @property (nonatomic, retain)

Having problems with Restkit nested mappings

隐身守侯 提交于 2019-12-25 02:44:38
问题 I've been trying to create a request to a login service, but i'm having problems when receiving the response, and i don't know what i'm doing wrong. Here's my code: AppDelagate /* LOGIN RESPONSE */ RKObjectMapping *userMapping = [RKObjectMapping mappingForClass:[UserMapping class]]; [userMapping addAttributeMappingsFromDictionary:@{ @"_id":@"_id", @"name": @"name", @"lastname": @"lastname", @"username": @"username", @"password": @"password", @"repeatPassword": @"repeatPassword", @"age": @"age

Issue with adding a one-to-one foreign-key connection to a RestKit mapping

大憨熊 提交于 2019-12-25 01:36:14
问题 I am trying to add a connection to a RestKit mapping but without success. My JSON is as follows: { parent: { token: "token" title: "title", description: "description", child_id: 1 } } My CoreData scheme defines that the Parent ManagedObject has a Child relation under the child key (and the opposite). The Parent mapping happens after I already have a corresponding Child object in CoreData, so that's not a problem. I followed some links and discussions around the web in order to solve this, but

Restkit mapping dependency

时光总嘲笑我的痴心妄想 提交于 2019-12-24 20:35:01
问题 Is it possible to make the mapping in restkit dependent on each other. I have the following JSON Structure: { "IdList": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ], “Persons”: [ { "Id": 2, "Name": “James”, "Description": “Tall”, "Items": [ { "Id": 1051, "Name": “Hat”, "Description": "", “Accesories”: [] } ] } ] } I have 2 response descriptors, in order to drill into the array IdList & Persons. RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor

RestKit not mapping recursive JSON to objects

百般思念 提交于 2019-12-24 14:57:23
问题 Edit 2 For reasons that I dont quite understand, adding the response descriptor directly to httpsRKManager, instead of the app layering, got RK to recognize the "Response" response descriptor. The issue now is that it seems not to recognize the attribute mapping for "ErrorStatus" /end edit I have three issues. First Shops and the recursive object Shop do not show up as part of the LLSResult object. Second the objects are not populated from the result, and third, is there a way to skip Shops

RestKit comparing local objects and remote objects before mapping or actually inserting into CoreData DB

烂漫一生 提交于 2019-12-24 13:13:36
问题 So I have started off with implementing my second project in RestKit, the previous one was very simple, just pull stuff from a remote service and fill in my core data db. In the current application I am working on a sync functionality, so I want to validate stuff before doing an insert i.e, compare an object in the local store with the object that I get from the remote service. I was reading this thread and found out that I could achieve something like this. So what I added these two methods

How do I ignore empty properties on posted objects using restkit

丶灬走出姿态 提交于 2019-12-24 12:14:38
问题 I am reviving an old project that originally used RestKit 0.10, and now am using RestKit 0.24. The old version still works, but unfortunately RestKit 0.10 is not 64-bit compatible and hence does not submit to the AppStore (and it is certainly time to update anyway). I cannot get an object to post correctly. In RestKit 0.10, properties without values were not sent to the server, whereas it seems in RestKit 0.20 they are. I have tried explicitly setting assignsDefaultValueForMissingAttributes

Restkit mapping issue - post newly created managed object to the server

寵の児 提交于 2019-12-24 11:34:08
问题 I'm trying to post new managed object to the server by using rest kit, but I don't know what I'm doing wrong. I'm getting exception like the following: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' RKRequestDescriptor objects must be initialized with a mapping whose target class is NSMutableDictionary , got 'Users' (see [RKObjectMapping requestMapping] )' I was looking for solution in stack overflow posts like this one This is my entity mapping method from

restkit and iso date

风流意气都作罢 提交于 2019-12-24 11:14:24
问题 I'm having trouble parsing an iso date from my json api/mongodb using rest kit. The iso date string I'm getting back is "2011-11-15T04:00:00Z" whichdoesn't get converted to an nsdate in my object, showing as null. What's the recommended work around if I can't format my date string, server side at the api? 回答1: Saw this post in google groups http://groups.google.com/group/restkit/browse_thread/thread/5ffaa4626209881 Looks like you would have to create your own date formatter and add it to the

Is there a way we can give dummy input to restkit?

偶尔善良 提交于 2019-12-24 08:14:30
问题 I am pretty new to the Restkit. I know how my restful response will be. Its not ready yet to get from the server side. Is there a way to give dummy input directly to restkit ? We can give json text file as an input to NSUrlConnection , similarly how to do it here? 回答1: I have been able to do this is - (RKObjectMappingResult*)mapResponseWithMappingProvider:(RKObjectMappingProvider*)mappingProvider toObject:(id)targetObject error:(NSError**)error { in RKObjectLoader.m where I optionally read a