Reputation: 1198
I am developing a chatting app and i have added Quickblox framework for chat, but while user update getting following error:
Request method: PUT
Request headers: { "Content-Type" = "application/json"; "QB-SDK" = "iOS 2.0.12"; "QB-Token" = b9a57f30857d7591d6766dac7345d78bc1c9f588; "QuickBlox-REST-API-Version" = "0.1.1"; } Request parameters:{ user = { email = "[email protected]"; "full_name" = "abc xyz"; login = 1234567890; password = abcdefghij; phone = 1234567890; }; }
Request headers: { "Content-Type" = "application/json"; "QB-SDK" = "iOS 2.0.12"; "QB-Token" = b9a57f30857d7591d6766dac7345d78bc1c9f588; "QuickBlox-REST-API-Version" = "0.1.1"; }
Response headers: { "Access-Control-Allow-Origin" = "*"; "Cache-Control" = "no-cache"; Connection = "keep-alive"; "Content-Type" = "application/json; charset=utf-8"; Date = "Sun, 01 Feb 2015 18:59:19 GMT"; "QB-Token-ExpirationDate" = "2015-02-01 20:57:39 UTC"; "QuickBlox-REST-API-Version" = "0.1.1"; Server = "nginx/1.0.15"; Status = "422 Unprocessable Entity"; "Transfer-Encoding" = Identity; "X-Rack-Cache" = "invalidate, pass"; "X-Request-Id" = 17331b69e1b7a38d8545629e241733c8; "X-Runtime" = "0.013145"; "X-UA-Compatible" = "IE=Edge,chrome=1"; }
i used following code...
if (firstName.length > 0 || lastName.length > 0 || email.length > 0 || mobileNo.length > 0 || country.length > 0) {
QBUUser *user = [QBUUser user];
AppUser *AppUser = [AppUser user];
user.ID = AppUser.ID;
user.login = AppUser.login;
user.password = AppUser.password;
user.fullName = [NSString stringWithFormat:@"%@ %@",firstName,lastName];
user.email = email;
user.phone = mobileNo;
[QBRequest updateUser:user
successBlock:^(QBResponse *response, QBUUser *user) {
AppUser *AppUser = [AppUser user];
AppUser.country = country;
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Information" message:@"Profile updated successfully." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
} errorBlock:^(QBResponse *response) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Error while updating." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}];
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Information" message:@"Fields can't be empty." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
Upvotes: 2
Views: 543
Reputation: 649
Try updating the user object first by removing (or commenting out) one of the fields above until you find the offending property. You updated so many all at once that you don't know which one is causing the problem.
I suspect the login property is the source, as I believe it is set and fixed at the time of registration and hence cannot be updated afterwards.
Upvotes: 1