restkit-0.20

RestKit - Map keypath of an array to the object inside of that array

六眼飞鱼酱① 提交于 2019-12-10 09:23:59
问题 I really stack up parsing this particular response with RestKit 0.20: "addons": [ { "id": 1, "name": "Addon one", "version": 2 }, { "id": 2, "name": "Addon two", "version": 3 } ], "forms": [ { "id": 1, "name": "Form one", "version": 1 } ] The problem is that I need to translate the response to an array of object of the same class, such as @interface MyCoreDataObject : NSManagedObject @property (nonatomic, retain) NSString * uid; @property (nonatomic, retain) NSNumber * version; @property

RestKit 0.20 — What is the preferred way to create a new NSManagedObject?

血红的双手。 提交于 2019-12-09 04:44:55
问题 I'm curious to know what the best way is to create a new NSManagedObject in RestKit 0.20? Currently my code looks something like this: #pragma mark - navigation buttons - (void)createButtonDidTouch { // create new album object NSManagedObjectContext *context = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; NSManagedObjectContext *parentContext = RKObjectManager.sharedManager.managedObjectStore.mainQueueManagedObjectContext; context.parentContext =

RestKit Core Data mapping connection with foreign key in the URL

陌路散爱 提交于 2019-12-08 20:58:35
I have an API with two endpoints: /projects { project_list:[{"project_id": 1, "project_name": "Ben"}, {"project_id": 2, "project_name": "Jerry"}] } /projects/1/members { member_list:[{"member_id": 1, "member_name": "Ben"}, {"member_id": 2, "member_name": "Jerry"}] } A project has-many members and a member has-one project. I'm using RestKit 0.20.1 to map these to a Core Data store. Current code: // ############################### // ## Configure Project mapping ## // ############################### RKEntityMapping *projectMapping = [RKEntityMapping mappingForEntityForName:@"Project"

RestKit mapping with NSDictionary and NSArray object

偶尔善良 提交于 2019-12-08 10:19:51
问题 {"coord":{"lon":72.62,"lat":23.03},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"base":"stations","main":{"temp":303.082,"pressure":1014.85,"humidity":66,"temp_min":303.082,"temp_max":303.082,"sea_level":1018.46,"grnd_level":1014.85},"wind":{"speed":1.07,"deg":340.501},"rain":{"3h":0.435},"clouds":{"all":76},"dt":1475333911,"sys":{"message":0.0033,"country":"IN","sunrise":1475283682,"sunset":1475326567},"id":1279233,"name":"Ahmadabad","cod":200} Above is my API

RestKit POST response with wrong mapping

耗尽温柔 提交于 2019-12-08 08:30:23
问题 When I am doing a POST of an object, the response mapped to wrong object. // Resquest for post new article RKObjectMapping* articleRequestMapping = [RKObjectMapping requestMapping]; [articleRequestMapping addAttributeMappingsFromDictionary:@{ @"title" : @"title", @"body" : @"body", }]; RKRequestDescriptor *requestDescriptorArticle = [RKRequestDescriptor requestDescriptorWithMapping:articleRequestMapping objectClass:[Article class] rootKeyPath:nil method:RKRequestMethodPOST]; [objectManager

Time based sync with restkit

亡梦爱人 提交于 2019-12-08 08:12:13
问题 Our app consumes a web api and also uses core data. We are successfully using Restkit to send and receive data between the app and the database. However we are having difficulty implementing a conditional sync between the server and the app. One of the tables on the server has an 'updated_at' field. The table corresponds to a NSManagedObject on our iOS application. We are trying to establish a means of updating the managed object on the device only if the 'updated_at' field being called from

RestKit Core Data mapping connection with foreign key in the URL

二次信任 提交于 2019-12-08 07:42:50
问题 I have an API with two endpoints: /projects { project_list:[{"project_id": 1, "project_name": "Ben"}, {"project_id": 2, "project_name": "Jerry"}] } /projects/1/members { member_list:[{"member_id": 1, "member_name": "Ben"}, {"member_id": 2, "member_name": "Jerry"}] } A project has-many members and a member has-one project. I'm using RestKit 0.20.1 to map these to a Core Data store. Current code: // ############################### // ## Configure Project mapping ## // ##########################

RestKit - Not been able to display JSON data onto my tableView

人走茶凉 提交于 2019-12-08 07:28:45
问题 I'm using Rest Kit 0.20.3 and Xcode 5 with core Data. I've recieved the JSON data from my server but I'm not able to display it on the tableView controller. Here is mapping and response descriptor code in AppDelegate.m RKEntityMapping *playerMapping = [RKEntityMapping mappingForEntityForName:@"Player" inManagedObjectStore:managedObjectStore]; [playerMapping addAttributeMappingsFromDictionary:@{@"id": @"playerID", @"name": @"playerName", @"age": @"playerAge", @"created_at": @"createdAt", @

Restkit fetching empty results on subsequent fetches

此生再无相见时 提交于 2019-12-08 06:11:04
问题 I am facing a really weird problem and I hope someone can help me. I am using Restkit (0.20) with CoreData setup, and I have all the attribute/relationship mapping setup for responseDescriptor. This is set correctly because when I call getObjectsAtPath:parameters the first time, I got the correct results back and it was able to map to the correct objects. However, on subsequent getObjectsAtPath calls, the mappingResult yields empty results for some reason, even though I can see the request

RestKit CoreData hangs during unit test

為{幸葍}努か 提交于 2019-12-08 05:18:59
问题 I am in the process of trying to get a test working for a service class that uses Restkit to perform various CoreData and JSON mapping operations related to the needs of our application. The service works fine when run via an iphone simulator deployment, but hangs when run via the context of a unit test. It looks to be related to thread usage in Restkit as I have been able to narrow it down to the following class and method call. Basically, the performBlockAndWait never returns. I am very new