Search code examples
ioserror-handlingquickblox

How to handle errors from Quickblox iOS SDK?


I got this message from quickblox ios sdk,

{
    errors =     {
        email =         (
            "has already been taken"
        );
    };
}

I'm not sure how to handle error with quickblox? Is there a list of error messages that I can by forget the issue? I got to print this message with help of QBResponse object like this,

NSLog(@"%@",response.error.reasons); 

Here reason is a NSDictionary, how do I know which error message key is inside?

At the same time, I got this message Expected status code in (200-299), got 422 for NSLog(@"%@",response.error.error.localizedDescription);


Solution

  • You should check localizedRecoverySuggestion at first, if nil is there, than you should look for reasons dictionary. Unfortunately there are no standard keys that you could expect.