Skip to content

Instantly share code, notes, and snippets.

@EchoAbstract
Created May 4, 2012 18:36
Show Gist options
  • Save EchoAbstract/2596810 to your computer and use it in GitHub Desktop.
Save EchoAbstract/2596810 to your computer and use it in GitHub Desktop.
Kinvey Delegate Methods
#pragma mark -
#pragma mark KCSPersistableDelegate
// Kinvey: Called when a save is complete
-(void)entity:(id)entity operationDidCompleteWithResult:(NSObject *)result
{
// Everything worked, so stop animating the activity indicator
[self.activityIndicator stopAnimating];
}
// Kinvey: Called when a save Fails
- (void)entity:(id)entity operationDidFailWithError:(NSError *)error
{
// Let the user know something went wrong and stop updating
[self.activityIndicator stopAnimating];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Unable to Save Note"
message:error.localizedDescription
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
#pragma mark -
#pragma mark KCSCollectionDelegate
// Kinvey: Called when our query finishes
- (void)collection:(KCSCollection *)collection didCompleteWithResult:(NSArray *)result
{
// Add all the returned annotations to the map
[self.worldView addAnnotations:result];
}
// Kinvey: Called when our query fails
- (void)collection:(KCSCollection *)collection didFailWithError:(NSError *)error
{
// Let the user know something went wrong and stop updating
[self.activityIndicator stopAnimating];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Unable to Get Notes"
message:error.localizedDescription
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment