I am using the following code to update a Parse object as button action:
-(IBAction)sendPressed:(id)sender
{
NSLog(@"boton subir cadena pulsado");
loadingSpinner.hidden = NO;
[loadingSpinner startAnimating];
//Upload a new picture
NSData *pictureData = UIImagePNGRepresentation(self.chainPhoto.image);
PFFile *file = [PFFile fileWithName:@"img" data:pictureData];
[file saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded){
NSLog(@"IMAGEN CARGADA");
PFQuery *query = [PFQuery queryWithClassName:@"cadenas"];
// Retrieve the object by id
[query getObjectInBackgroundWithId: chain.objectId block:^(PFObject *imageObject, NSError *error)
{
[imageObject setObject:file forKey:@"image"];
[imageObject setObject:self.commentTextField.text forKey:@"chain_name"];
[imageObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded){
//Go back to the wall
[self.navigationController popViewControllerAnimated:YES];
}
else{
NSString *errorString = [[error userInfo] objectForKey:@"error"];
[self showErrorView:errorString];
}
}];
}
ERROR HERE--> else
{
NSString *errorString = [[error userInfo] objectForKey:@"error"];
[self showErrorView:errorString];
}
}
[loadingSpinner stopAnimating];
//loadingSpinner.hidden = YES;
//self.commentTextField.text =@" ";
self.progress_block.hidden = YES;
// self.imageView.image = [UIImage imageNamed:@"no-image.jpg"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Restaurant Chain changed with success"
message:@"You can now go back to the list."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
} progressBlock:^(int percentDone) {
self.progress_block.hidden =NO;
self.progress_block.progress = (float) percentDone/100+progressValue;
}];
}
In the line that I have marked as ERROR HERE in the code, there is an error warning (Expected ":"), but I can't find out why.
Any help is welcome.