SHARE
TWEET

Untitled

a guest Feb 11th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cliffMapping.primaryKeyAttribute = @"cliffID";
  2. cliffMapping.rootKeyPath = @"cliffs";
  3. [cliffMapping mapKeyPath:@"name" toAttribute:@"name"];
  4. [cliffMapping mapKeyPath:@"cliffId" toAttribute:@"cliffID"];
  5. [cliffMapping mapKeyPath:@"description" toAttribute:@"cliffDescription"];
  6. [cliffMapping mapKeyPath:@"notes" toAttribute:@"notes"];
  7. [cliffMapping mapKeyPath:@"city" toAttribute:@"city"];
  8. [cliffMapping mapKeyPath:@"intensity" toAttribute:@"intensity"];
  9. [cliffMapping mapKeyPath:@"latitude" toAttribute:@"latitude"];
  10. [cliffMapping mapKeyPath:@"height" toAttribute:@"height"];
  11. [cliffMapping mapKeyPath:@"longitude" toAttribute:@"longitude"];
  12. [cliffMapping mapKeyPath:@"zipcode" toAttribute:@"zipcode"];
  13. [objectManager.mappingProvider setMapping:cliffMapping forKeyPath:@"cliffs"];
  14. [objectManager.mappingProvider addObjectMapping:cliffMapping];
  15.  
  16. RKManagedObjectMapping* stateMapping = [RKManagedObjectMapping mappingForClass:[State class] inManagedObjectStore:objectManager.objectStore];
  17. stateMapping.rootKeyPath = @"States";
  18. stateMapping.primaryKeyAttribute = @"stateID";
  19. [stateMapping mapKeyPath:@"stateId" toAttribute:@"stateID"];
  20. [stateMapping mapKeyPath:@"name" toAttribute:@"name"];
  21. [stateMapping mapKeyPath:@"version" toAttribute:@"sversion"];
  22. [stateMapping mapKeyPath:@"cliffAmount" toAttribute:@"cliffAmount"];
  23. [stateMapping mapRelationship:@"cliffs" withMapping:cliffMapping];
  24. [objectManager.mappingProvider setMapping:stateMapping forKeyPath:@"States"];
  25. [objectManager.mappingProvider addObjectMapping:stateMapping];
  26. [objectManager loadObjectsAtResourcePath:@"/Application/getEverything" usingBlock:^(RKObjectLoader *loader){
  27.     loader.serializationMIMEType = RKMIMETypeJSON;
  28.     loader.resourcePath = @"/Application/getEverything";
  29.     loader.method = RKRequestMethodPOST;
  30.     loader.delegate = self;
  31.     loader.objectMapping = stateMapping;
  32. }];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top