Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cliffMapping.primaryKeyAttribute = @"cliffID";
- cliffMapping.rootKeyPath = @"cliffs";
- [cliffMapping mapKeyPath:@"name" toAttribute:@"name"];
- [cliffMapping mapKeyPath:@"cliffId" toAttribute:@"cliffID"];
- [cliffMapping mapKeyPath:@"description" toAttribute:@"cliffDescription"];
- [cliffMapping mapKeyPath:@"notes" toAttribute:@"notes"];
- [cliffMapping mapKeyPath:@"city" toAttribute:@"city"];
- [cliffMapping mapKeyPath:@"intensity" toAttribute:@"intensity"];
- [cliffMapping mapKeyPath:@"latitude" toAttribute:@"latitude"];
- [cliffMapping mapKeyPath:@"height" toAttribute:@"height"];
- [cliffMapping mapKeyPath:@"longitude" toAttribute:@"longitude"];
- [cliffMapping mapKeyPath:@"zipcode" toAttribute:@"zipcode"];
- [objectManager.mappingProvider setMapping:cliffMapping forKeyPath:@"cliffs"];
- [objectManager.mappingProvider addObjectMapping:cliffMapping];
- RKManagedObjectMapping* stateMapping = [RKManagedObjectMapping mappingForClass:[State class] inManagedObjectStore:objectManager.objectStore];
- stateMapping.rootKeyPath = @"States";
- stateMapping.primaryKeyAttribute = @"stateID";
- [stateMapping mapKeyPath:@"stateId" toAttribute:@"stateID"];
- [stateMapping mapKeyPath:@"name" toAttribute:@"name"];
- [stateMapping mapKeyPath:@"version" toAttribute:@"sversion"];
- [stateMapping mapKeyPath:@"cliffAmount" toAttribute:@"cliffAmount"];
- [stateMapping mapRelationship:@"cliffs" withMapping:cliffMapping];
- [objectManager.mappingProvider setMapping:stateMapping forKeyPath:@"States"];
- [objectManager.mappingProvider addObjectMapping:stateMapping];
- [objectManager loadObjectsAtResourcePath:@"/Application/getEverything" usingBlock:^(RKObjectLoader *loader){
- loader.serializationMIMEType = RKMIMETypeJSON;
- loader.resourcePath = @"/Application/getEverything";
- loader.method = RKRequestMethodPOST;
- loader.delegate = self;
- loader.objectMapping = stateMapping;
- }];
Add Comment
Please, Sign In to add comment