restkit-0.20

RestKit data synchronization post local-deletion issue

空扰寡人 提交于 2020-01-06 04:35:13
问题 I'm using RestKit for an app's backend. Everything is working well, however I'm running into an issue with fetching unaltered data post local deletion. This is the path matching: [self.objectManager addFetchRequestBlock:^NSFetchRequest *(NSURL *URL) { RKPathMatcher *pathMatcher = [RKPathMatcher pathMatcherWithPattern:@"cards"]; if([pathMatcher matchesPath:[URL relativePath] tokenizeQueryStrings:NO parsedArguments:nil]) return [NSFetchRequest fetchRequestWithEntityName:@"Card"]; return nil; }]

Map url parameters to objects using RESTKit

南笙酒味 提交于 2019-12-28 15:36:20
问题 is there a way to map the parameters in an URL to the results? I got a rest service where the user can search something by its ID. The path is search/:id The results contains the name and other properties but not the ID. I could do something like this: NSArray *array = mappingResult.array; for (Item *item in array) { [item setId:itemID]; } but I hope there is a nicer way... Thanks for any hints Xean 回答1: You want to use the path pattern you specify in your response descriptor. Then you want

RestKit - Sync Data Base with local JSON file

有些话、适合烂在心里 提交于 2019-12-25 18:47:42
问题 I have provided with a sample JSON file (for testing purpose I haven't early access to the web service). after loading the file and converting to NSDictionary how can I use that dictionary and sync my data base? all the tutorials and samples I've read use web service I have created my mapping for all of the objects and applied their relationship. an example: + (RKEntityMapping *) mapTableInManagedObjectStore:(RKManagedObjectStore *)managedObjectStore { RKEntityMapping *tableMapping =

Upgrading RestKit from 0.10 to 0.20 problems

前提是你 提交于 2019-12-25 09:25:52
问题 I can't figure out how to correct the errors I'm getting after having upgraded from RestKit 0.10 to 0.20... Can anyone help? Thanks! ViewController.m - (void)viewDidLoad { // Wain, I added this RKResponseDescriptor RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:[Feed mapping] method:RKRequestMethodAny pathPattern:nil keyPath:@"springs" statusCodes:nil]; // These 4 lines has errors and needs to be fixed // No visible @interface for

RESTKit: Duplicate Objects in relationship after POST

ぃ、小莉子 提交于 2019-12-25 03:54:29
问题 Below is my setup: - (RKManagedObjectStore *)setupCoreDataWithRESTKit { NSError * error; NSURL * modelURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"App" ofType:@"momd"]]; NSManagedObjectModel * managedObjectModel = [[[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL] mutableCopy]; self.managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel]; [self.managedObjectStore createPersistentStoreCoordinator]; NSArray *

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

RestKit 0.2x: checking for a condition at inserting time

那年仲夏 提交于 2019-12-25 01:53:45
问题 I have setup my project to use restKit with core data (1 entity) without problems, however, I intentionally left 1 boolean attribute without mapping for some app design purpose. I want to set this boolean according to a condition related to the current record being inserted, i.e. if this record contains a property that equals xxx then set this boolean to YES. how can I do something like this with restKit 0.2x at the time of inserting that record in the persistent store. thanks in advance. 回答1

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 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