Skip to content

Instantly share code, notes, and snippets.

@sstadelman
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sstadelman/2c646c85966ddb5a9f71 to your computer and use it in GitHub Desktop.
Save sstadelman/2c646c85966ddb5a9f71 to your computer and use it in GitHub Desktop.
Example with block createEntity
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"ReturnInputFromAdd"]) {
self.properties = [NSMutableArray array];
prop = [[SODataPropertyDefault alloc] initWithName:@"NAME"];
prop.value = self.nameInput.text;
[self.properties addObject:prop];
prop = [[SODataPropertyDefault alloc] initWithName:@"URL"];
prop.value = self.urlInput.text;
[self.properties addObject:prop];
SODataEntityDefault* entity = [[SODataEntityDefault alloc] initWithType:@"RMTSAMPLEFLIGHT.Travelagency"];
for (id<SODataProperty> prop in self.properties) {
[entity.properties setObject:prop forKey:prop.name];
}
self.travelAgency = entity;
if (self.travelAgency) {
[[DataController shared] createEntity:self.travelAgency withCompletion:^(BOOL success) {
[[DataController shared] fetchTravelAgencyEntitySet];
}];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment