Skip to content

Instantly share code, notes, and snippets.

@cdl
Created March 4, 2014 04:39
Show Gist options
  • Save cdl/9340388 to your computer and use it in GitHub Desktop.
Save cdl/9340388 to your computer and use it in GitHub Desktop.
// self.heldStoryPocketID – NSString containing the integer of the Pocket item ID grabbed from the API
NSError *error;
NSArray *actions = @[@{@"action": @"delete", @"item_id": self.heldStoryPocketID}];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:actions options:kNilOptions error:&error];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSDictionary *args = @{@"actions": jsonString};
[[PocketAPI sharedAPI] callAPIMethod:@"send" withHTTPMethod:PocketAPIHTTPMethodPOST arguments:args handler:^(PocketAPI *api, NSString *apiMethod, NSDictionary *response, NSError *error) {
if (error) {
// error
} else {
// remove story from data source, reload
// data in collection view, show notification
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment