easemob / sdkdemoapp3.0_android

Apache License 2.0
312 stars 173 forks source link

注册时出现错误:code : 208 ,description : Registration failed. #371

Open xue12311 opened 5 years ago

xue12311 commented 5 years ago

注册时出现错误:code : 208 ,description : Registration failed.

注册模式:选择的是 开放注册 图片

注册代码写在IO线程中 GlobalScope.launch(Dispatchers.Main) { try { withContext(Dispatchers.IO) { LogUtils.d("当前线程: ${Thread.currentThread().name} ") EMUtils.getInstance().createAccount(userName, passWord) } ...... } catch (e: HyphenateException) { LogUtils.e("code : ${e.errorCode} ,description : ${e.description}") val errorCode = e.errorCode if (errorCode == EMError.NETWORK_ERROR) {//网络异常 showToastMessage(getString(R.string.network_isnot_available)) } else if (errorCode == EMError.USER_ALREADY_EXIST) {//用户已经存在 showToastMessage(getString(R.string.User_already_exists)) } else if (errorCode == EMError.USER_AUTHENTICATION_FAILED) {//无权限 showToastMessage(getString(R.string.registration_failed_without_permission)) } else if (errorCode == EMError.USER_ILLEGAL_ARGUMENT) {//用户名不合法 showToastMessage(getString(R.string.illegal_user_name)) } else if (errorCode == EMError.EXCEED_SERVICE_LIMIT) {//App用户注册数量已达上限 showToastMessage(getString(R.string.register_exceed_service_limit)) } else {//注册失败 showToastMessage(getString(R.string.Registration_failed)) } } }