restkit

RestKit 0.20.1 How to map parent id

China☆狼群 提交于 2019-12-19 10:56:11
问题 Given this XML payload: <payload> <year yearNum="2013"> <month monthNum="6" desc="This month was an enlightening month"/> <month monthNum="5" desc="This month was a questioning month"/> <month monthNum="4" desc="This month was a good month"/> <month monthNum="3" desc="This month was a crazy month"/> <month monthNum="2" desc="This month was a dry month"/> <month monthNum="1" desc="This month was a slow month"/> </year> <year yearNum="2012"> <month monthNum="12" desc="This month was a cold

Nested objects in NSDictionary with RestKit

拈花ヽ惹草 提交于 2019-12-19 09:44:21
问题 I have a JSON document which contains objects with known schema in an object with unknown keys and I'll like to map that with RestKit. Let me explain this: { "object": { "unknownKey1" : {"data1" : "...", "data2" : "..."}, "unknownKey2" : {"data1" : "...", "data2" : "..."}, "unknownKey3" : {"data1" : "...", "data2" : "..."} } } The setup of the object with key "object" is only known at runtime. The keys included in the object have random names. However, I know the exact schema of the objects

RestKit GET query parameters

梦想与她 提交于 2019-12-19 07:04:31
问题 I've been using RestKit 0.10.0 for a while now and up until this point, I only posted serialized objects to my server: [[RKObjectManager sharedManager] postObject:serializedObject usingBlock:^(RKObjectLoader *loader) { loader.delegate = self; loader.objectMapping = responseMapping; loader.serializationMIMEType = RKMIMETypeFormURLEncoded; loader.targetObject = nil; }]; So far, so good. But I now need to make a GET request to the server with a few query parameters. The first natural thing that

RestKit Core Data NSError dealloc Crash

為{幸葍}努か 提交于 2019-12-19 03:59:13
问题 Trying to get to the bottom of an issue I've been seeing in production builds and FINALLY was able to reproduce it while testing. Using RestKit v0.23.1, when doing an RKManagedObjectRequestOperation using the following code (while plugged into instruments) I get "An Objective-C message was sent to a deallocated 'NSError' object (zombie)" and the app crashes every time there's objects in the response JSON - if the response is something like "objects = ();" there's no crash - so I'm guessing it

RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class

一笑奈何 提交于 2019-12-18 18:47:17
问题 I ran into a new problem that I can't seem to find a way around... Here is my RestKit code, following the Twitter Core Data example: // // RESTKIT // // restkit object manager NSString *baseURL = @"http://test1.website.com"; RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:baseURL]]; // enable activity indicator [AFNetworkActivityIndicatorManager sharedManager].enabled = YES; // managed object model NSURL *modelURL = [[NSBundle mainBundle]

Parsing JSON without Object Mapping in Restkit iOS

余生长醉 提交于 2019-12-18 13:35:13
问题 I've created a login page which uses Restkit RKClient to send login details, and get back JSON data (either the user or an error). I want to be able to parse the JSON data without object mapping, just JSON to dictionary. The reason for this is it's just a simple login thats sending username and password, if I set up object mapping, i'll have to set up the login details into a Login object, then set up routing etc... and it seem a bit long winded. Here is my code - (IBAction)login:(id)sender {

Mapping a JSON response to an object using RestKit and Objective-C

十年热恋 提交于 2019-12-18 12:43:20
问题 I am relatively new to Objective-C and am attempting to use RestKit to receive a JSON response from a web service. I have successfully received the data back to my application, which looks like this viewing the response: {id:"1","Translation":"Test"} I would like to map this translation to my "Translation" object in my application, but have tried a few different ways but am not sure how to achieve this. So my questions are: How can I map this response to my Translation object Am I doing this

Deserializing local NSString of JSON into objects via RestKit (no network download)

跟風遠走 提交于 2019-12-17 23:47:32
问题 Is it possible to deserialize an NSString of JSON into objects via RestKit? I checked the API list here and could not find something that would serve for this purpose. The closest I could find are the various parser classes that return NSDictionary after parsing the input. I assume RestKit uses these parsers after downloading the response so my thinking is that the functionality is available somewhere in RestKit but not exposed publicly. If I am not missing anything and this functionality is

Deserializing local NSString of JSON into objects via RestKit (no network download)

試著忘記壹切 提交于 2019-12-17 23:47:16
问题 Is it possible to deserialize an NSString of JSON into objects via RestKit? I checked the API list here and could not find something that would serve for this purpose. The closest I could find are the various parser classes that return NSDictionary after parsing the input. I assume RestKit uses these parsers after downloading the response so my thinking is that the functionality is available somewhere in RestKit but not exposed publicly. If I am not missing anything and this functionality is

Restkit request not sending parameters

本秂侑毒 提交于 2019-12-17 20:41:05
问题 My implementation is not sending parameters. Here is the RequestDescriptor: RKObjectMapping *userMapping = [RKObjectMapping requestMapping]; [userMapping addAttributeMappingsFromArray:@[@"nombres", @"telefono", @"direccion", @"email", @"identificacion", @"tipo_id", @"recibir_sms_ordenes", @"recibir_correos_ordenes"]]; RKRequestDescriptor *descriptor = [RKRequestDescriptor requestDescriptorWithMapping:userMapping objectClass:[RKUser class] rootKeyPath:@"me" method:RKRequestMethodAny]; [