I’m wondering how to update a row associated with a user in a Backendless collection. When a user registered, a new row is added in the collection. If the user edits their profile, I’d like the row associated with them to update as well. I can’t get it to work for some reason. Here’s the code:
QueryOptions *query = [QueryOptions query];
BackendlessDataQuery *dataQuery = [BackendlessDataQuery query:nil where:nil query:query];
dataQuery.whereClause = [NSString stringWithFormat:@"userEmail = \'%@\'", userUpdated.email];
[backendless.persistenceService find:[Profile class] dataQuery:dataQuery
response:^(BackendlessCollection *collection) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
for (Profile *new in collection.data)
{
new.country =self.countryTextField.text;
new.favoriteSong = self.firstNameTextField.text;
NSString *countrytext = new.country;
NSString *favsong = self.firstNameTextField.text;
NSMutableDictionary *row;
row = [NSMutableDictionary dictionary];
[row setObject:@{ @"type": @"string", @"value": countrytext } forKey:@"country"];
[row setObject:@{ @"type": @"string", @"value": favsong } forKey:@"favoriteSong"];
}
[[NSNotificationCenter defaultCenter] postNotificationName:@"DataSheetModified" object:self];
}
error:^(Fault *fault) {
NSLog(@"Server reported an error: %@", fault);
}];