ios


Warning inside code when updating Parse object


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.
From the looks of it, you never closed the query bracket:
PFQuery getObjectInBackground.... {
but never closed it using the proper syntax or it looks like you have an extra bracket }. For better practice, you should use proper indentation with if statements or else complications can happen like this. You get lost in the code because you don't know where a statement begins or ends
You should close it after the else statement so:
} ERROR HERE--> else {
NSString *errorString = [[error userInfo] objectForKey:#"error"];
[self showErrorView:errorString];
//stop animating and other stuff
}
}];
I can't troubleshoot because i'm on my iPhone but I would suggest going back and using proper indentation so you can catch your culprit

Related Links

how to get today's date less 18 years
iOS Not able to change the frame of UITextField inputAccessoryView.superview
Publishing issue, Callkit is included even we are not using it
How to get crash information from a TestFlight launched app?
Parse: Updating relation on user in Local Datastore
iOS 10, Local notification show when app is in forground?
What is the reason for this UITableView not showing up on my view controller?
Xcode inserted fileprivate functions after updating to Swift 3 [duplicate]
Xamarin ios UItableView Empty rows at top using Task Scheduler in background
How to test iOS app's localization on a real device when using appium?
How to prevent NSInternalInconsistencyException with Realm and UICollectionView
(Swift, EarlGrey) move slider to the middle
How can I make physicBody dynamic only on needed levels?
check if item exists in core data EFFICIENTLY
How to continue in the background a connection started with NSURLConnection in the foreground?
Using delegate methods to save a custom cell textfield

Categories

HOME
azure
opencv
vb.net
angular2-forms
apache-pig
vsix
box
geany
jasypt
pyusb
telerik
wget
py.test
overloading
marketplace
nanotime
android-dialogfragment
factory-girl
next
flow
jmeter-plugins
haml
co
deadbolt
addthis
spring-batch-admin
toolbar
ucwa
python-behave
file-manager
angular2-databinding
evercookie
dlopen
dashboard-designer
double-click-advertising
presto
xaf
decompiler
vue2
uistoryboardsegue
atlassian-bitbucketserver
visualsvn-server
internet-explorer-10
psychopy
gradle-tooling-api
zfs
win2d
program-slicing
hostapd
pseudo-element
openwebanalytics
name-mangling
html-form
wrk
multisite
jquery-masonry
notimplementedexception
jasmine2.0
simple.odata.client
easyhook
jvm-arguments
angular-directive
waf
zenity
geneticsharp
vistadb
mink
post-increment
ckcontainer
pager
ios-frameworks
vsvim
google-api-ruby-client
clientid
document-ready
interpreted-language
esky
user-registration
avalonedit
cvc4
size-t
newsql
simpleadapter
spiceworks
tortoisecvs
sqlhelper
iqueryable
bonecp
xml.modify
blazeds
srp
blueprint
shift
libnids
osmf
hudson-plugins
wpf-4.0
jmdns
locomotivejs
haar-wavelet
squirrelmail
mixing
nextpeer
time-limiting
mknetworkkit
exact-synergy-enterprise
ramaze
facebook-authentication
custom-protocol
xtratreelist
gumstix
net-ssh
coords
project-settings
contracts
development-machine
sharepoint-feature
roguelike

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App