Handling Message: Login: { Message id: 1 }
{Dump: }
(short) ec: 28
(utf_string_array) ep: [(
"userName has badword"
)]
How could i get the error code from the event onLoginError
- A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
Re: How could i get the error code from the event onLoginErr
Have a look at the docs: http://docs2x.smartfoxserver.com/api-do ... LoginError:
An easy way to loop through the entire response object (for any event) would be:
Code: Select all
-(void)onLoginError:(SFSEvent *)evt
{
NSLog(@"Login Failed. Reason: %@" ,[evt.params objectForKey:@"errorMessage"]);
}
An easy way to loop through the entire response object (for any event) would be:
Code: Select all
-(void)onLoginError:(SFSEvent *)evt
{
NSArray *keys = [evt.params allKeys];
for (NSString *key in keys)
{
NSLog(@"%@: %@", key, [evt.params objectForKey:key]);
}
}
A51 Integrated
http://a51integrated.com / +1 416-703-2300
http://a51integrated.com / +1 416-703-2300
Re: How could i get the error code from the event onLoginErr
There was not a key of "errorCode",I just see a key name "success" and it's value always "0".
- A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
Re: How could i get the error code from the event onLoginErr
Please make sure you're using the latest server patch and the latest iOS API:
http://www.smartfoxserver.com/download/sfs2x#p=updates
If you post some code, maybe we can have a look and see if there is something you're doing wrong.
http://www.smartfoxserver.com/download/sfs2x#p=updates
If you post some code, maybe we can have a look and see if there is something you're doing wrong.
Re: How could i get the error code from the event onLoginErr
I have the same problem.
No matter what I do it not work.even in my own errocode
server1:
SFSErrorData errData = new SFSErrorData(SFSErrorCode.LOGIN_BAD_PASSWORD);
errData.addParameter(userName);
throw new SFSLoginException("Error", errData);
server2:
SFSErrorData errData = new SFSErrorData(SFSErrorCode.LOGIN_BAD_USERNAME);
errData.addParameter(userName);
throw new SFSLoginException("Error", errData);
server3:
SFSErrorData ed = new SFSErrorData(MyCustomErrors.USER_IS_CREATED);
ed.addParameter(userName);
throw new SFSLoginException("Right, user created", ed);
server3:
SFSErrorData ed = new SFSErrorData(MyCustomErrors.USER_IS_EXISTED);
ed.addParameter(userName);
throw new SFSLoginException("Wrong, user is existed", ed);
client:
private void onLoginError(BaseEvent evt){
Debug.Log("Login error (" + evt.Params["errorCode"] + "): " + evt.Params["errorMessage"]);
}
get: (always the same)
Login error (28): An unexpected error occurred, please check the server side logs
No matter what I do it not work.even in my own errocode
server1:
SFSErrorData errData = new SFSErrorData(SFSErrorCode.LOGIN_BAD_PASSWORD);
errData.addParameter(userName);
throw new SFSLoginException("Error", errData);
server2:
SFSErrorData errData = new SFSErrorData(SFSErrorCode.LOGIN_BAD_USERNAME);
errData.addParameter(userName);
throw new SFSLoginException("Error", errData);
server3:
SFSErrorData ed = new SFSErrorData(MyCustomErrors.USER_IS_CREATED);
ed.addParameter(userName);
throw new SFSLoginException("Right, user created", ed);
server3:
SFSErrorData ed = new SFSErrorData(MyCustomErrors.USER_IS_EXISTED);
ed.addParameter(userName);
throw new SFSLoginException("Wrong, user is existed", ed);
client:
private void onLoginError(BaseEvent evt){
Debug.Log("Login error (" + evt.Params["errorCode"] + "): " + evt.Params["errorMessage"]);
}
get: (always the same)
Login error (28): An unexpected error occurred, please check the server side logs
- A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
Re: How could i get the error code from the event onLoginErr
I'm not sure what you're trying to do here. What do the server logs say? Also, make sure you're posting your question to the right forum - this is for Objective-C / iOS API.
Re: How could i get the error code from the event onLoginErr
Thanks for your reply.
I have solved this problem
I have solved this problem
Return to “SFS2X iPhone / iPad / OSX API”
Who is online
Users browsing this forum: No registered users and 37 guests