注册

swift3.0集成环信V3.0不管是登录还是注册,环信后台都是成功注册和登录的,但是代码上就报错了


帖子中"忽略"文字为环信后台的appkey


 这是登录的错误,环信后台查看是已经登录成功了:
[2016/9/24 16:38:23:128]: onNetworkChanged(): 2

[2016/9/24 16:38:23:137]: EMSessionManager::login(): ngt

[2016/9/24 16:38:23:138]: getDnsListFromServer()

[2016/9/24 16:38:23:139]: buildUrl(): http://rs.easemob.com/easemob/server.json?sdk_version=3.1.5&app_key=忽略%23忽略&file_version=1

[2016/9/24 16:38:23:308]: 1 time retry

[2016/9/24 16:38:23:308]: DNS List size: 888

[2016/9/24 16:38:23:309]: EMSessionManager::parseDnsServer: {"file_version":"269","resolver":{"hosts":[{"port":"80","domain":"rs.easemob.com","ip":"112.126.66.111"},{"port":"80","domain":"rs.easemob.com","ip":"182.92.174.78"}]},"rest":{"hosts":[{"protocol":"https","port":"443","domain":"a1.easemob.com"},{"protocol":"http","port":"80","domain":"a1.easemob.com","ip":"182.92.228.160"},{"protocol":"http","port":"80","domain":"a1.easemob.com","ip":"182.92.159.193"}]},"valid_before":"1480014000","im":{"hosts":[{"port":"443","domain":"im1.easemob.com","ip":"182.92.20.34"},{"port":"443","domain":"im1.easemob.com","ip":"182.92.20.117"},{"port":"443","domain":"im1.easemob.com","ip":"182.92.23.59"},{"port":"443","domain":"im1.easemob.com","ip":"182.92.26.56"}]},"deploy_name":"easemob","msync-im":{"hosts":[{"port":"6824","domain":"msync-im1.easemob.com","ip":"182.92.23.113"},{"port":"7807","domain":"msync-im1.easemob.com","ip":"60.205.109.58"}]}}

[2016/9/24 16:38:23:324]: current time: 1474706303323

[2016/9/24 16:38:23:325]: valid time: 1480014000000

[2016/9/24 16:38:23:325]: saveConfigs()

[2016/9/24 16:38:23:335]: write to config file: {

    "dns_time":"1480014000000"

}

[2016/9/24 16:38:23:338]: ranomOffer

[2016/9/24 16:38:23:339]: imServer before random: 

[2016/9/24 16:38:23:340]: 182.92.23.113

[2016/9/24 16:38:23:341]: 60.205.109.58

[2016/9/24 16:38:23:342]: randomServers 

[2016/9/24 16:38:23:343]: randomServers 

[2016/9/24 16:38:23:343]: randomServers 

[2016/9/24 16:38:23:344]: imServer after random: 

[2016/9/24 16:38:23:345]: 182.92.23.113

[2016/9/24 16:38:23:346]: 60.205.109.58

[2016/9/24 16:38:23:348]: fetchToken()

[2016/9/24 16:38:23:348]: restBaseUrl()

[2016/9/24 16:38:23:349]: EMDNSManager::getCurrentHost: type: 2

[2016/9/24 16:38:23:350]: EMSessionManager::checkDNS()

[2016/9/24 16:38:23:352]: EMDNSManager::getHost: type: 2

[2016/9/24 16:38:23:353]: current host: domain: 182.92.159.193 port: 80

[2016/9/24 16:38:23:354]: fetchTokenForUser()http://182.92.159.193:80/忽略/token

[2016/9/24 16:38:23:422]: [retrieve token time] 0: 0: 73

[2016/9/24 16:38:23:423]: fetchToken success 

[2016/9/24 16:38:23:424]: saveToken(): user: ngt time: 1474706303424

[2016/9/24 16:38:23:440]: savetoken() result: 1

[2016/9/24 16:38:23:441]: token is valid:   time: 1474706303424

[2016/9/24 16:38:23:442]: EMDNSManager::getCurrentHost: type: 1

[2016/9/24 16:38:23:443]: EMSessionManager::checkDNS()

[2016/9/24 16:38:23:444]: EMDNSManager::getHost: type: 1

[2016/9/24 16:38:23:446]: current host: domain: 182.92.23.113 port: 6824

[2016/9/24 16:38:23:447]: setServer: 182.92.23.113

[2016/9/24 16:38:23:448]: Calling connect...

[2016/9/24 16:38:23:449]: doConnect()

[2016/9/24 16:38:23:451]: current connectState: 0

[2016/9/24 16:38:23:452]: log: level: 0, area: 1, ChatClient::connect() 

[2016/9/24 16:38:23:458]: log: level: 0, area: 2, getSocket(): 12

[2016/9/24 16:38:23:459]: log: level: 1, area: 2, connectSocket(): start to connecting...

[2016/9/24 16:38:23:468]: log: level: 1, area: 2, connectSocket(): connect finished

[2016/9/24 16:38:23:473]: log: level: 1, area: 1, SEND:

{ verison : MSYNC_V1, guid :忽略/mobile, auth : $t$YWMtNVaK4IFeEeaT0RVPBpD3oAAAAViK6E9raIch7YZ-1coQY5OAuk0YEe2ymcE, compress_algorimth : 0, command : PROVISION, payload : { os_type : 0, version : 3.1.5 } }




[2016/9/24 16:38:23:481]: Calling connect result: 1

[2016/9/24 16:38:23:483]: start startReceive()

[2016/9/24 16:38:23:496]: log: level: 1, area: 1, RECV:

{ verison : MSYNC_V1, command : PROVISION, payload : { status : { error_code : 0 } } }




[2016/9/24 16:38:23:501]: EMSessionManager::onConnect()

[2016/9/24 16:38:23:502]: [im login time] 0: 0: 54

[2016/9/24 16:38:23:503]: log: level: 1, area: 1, SEND:

{ verison : MSYNC_V1, compress_algorimth : 0, command : UNREAD, payload : {  } }




[2016/9/24 16:38:23:503]: login return: 0

[2016/9/24 16:38:23:503]: notify state change to connection listener

[2016/9/24 16:38:23:506]: [chat login time] 0: 0:377

[2016/9/24 16:38:23:507]: setPresence

[2016/9/24 16:38:23:508]: log: level: 1, area: 1, SEND:

{ verison : MSYNC_V1, compress_algorimth : 0, command : SYNC, payload : { meta : { id : 367, ns : STATISTIC, payload : { operation : 0, im_time : 54, chat_time : 377 } } } }




[2016/9/24 16:38:23:515]: log: level: 1, area: 1, RECV:

{ verison : MSYNC_V1, command : UNREAD, payload : { status : { error_code : 0 }, timestamp : 1474706303491 } }




[2016/9/24 16:38:23:515]: onNetworkChanged(): 2

[2016/9/24 16:38:23:517]: log: level: 0, area: 1, NO unread queue, an response for ping?

[2016/9/24 16:38:23:521]: [load all conversations time] time spent on loading all conversations : conversation size 0 messages count : 0 with time spent :  0: 0:  2

[2016/9/24 16:38:23:524]: log: level: 1, area: 1, RECV:

{ verison : MSYNC_V1, command : SYNC, payload : { status : { error_code : 0 }, meta_id : 367, server_id : 245420888722245624, timestamp : 1474706303499 } }




[2016/9/24 16:38:23:525]: [load all local groups] load all local group with size : 0 with time spent :  0: 0:  1

[2016/9/24 16:38:23:527]: getContactsFromDB()

[2016/9/24 16:38:23:530]: log: level: 1, area: 1, ChatClient::handleSync begin

[2016/9/24 16:38:23:530]: getBlackListFromDB()

[2016/9/24 16:38:23:532]: log: level: 1, area: 1, ChatClient::handlfatal error: unexpectedly found nil while unwrapping an Optional value

eSync complete: response 
 
 
 
这是注册的,其实也是注册成功了,后台查看用户已经存在了:

[2016/9/24 16:43:17:224]: EMSessionManager::createAccount()

[2016/9/24 16:43:17:225]: restBaseUrl()

[2016/9/24 16:43:17:225]: EMDNSManager::getCurrentHost: type: 2

[2016/9/24 16:43:17:226]: EMSessionManager::checkDNS()

[2016/9/24 16:43:17:226]: valid_time: 1480014000000

[2016/9/24 16:43:17:226]: EMSessionManager::parseDnsServer: 

[2016/9/24 16:43:17:228]: current time: 1474706597228

[2016/9/24 16:43:17:229]: valid time: 1480014000000

[2016/9/24 16:43:17:230]: saveConfigs()

[2016/9/24 16:43:17:231]: write to config file: {

    "dns_time":"1480014000000"

}

[2016/9/24 16:43:17:233]: ranomOffer

[2016/9/24 16:43:17:233]: imServer before random: 

[2016/9/24 16:43:17:234]: 182.92.23.113

[2016/9/24 16:43:17:234]: 60.205.109.58

[2016/9/24 16:43:17:234]: randomServers 

[2016/9/24 16:43:17:235]: randomServers 

[2016/9/24 16:43:17:235]: randomServers 

[2016/9/24 16:43:17:235]: imServer after random: 

[2016/9/24 16:43:17:236]: 182.92.23.113

[2016/9/24 16:43:17:236]: 60.205.109.58

[2016/9/24 16:43:17:237]: passed_time: -5307402763

[2016/9/24 16:43:17:237]: current time: 1474706597237

[2016/9/24 16:43:17:238]: validBefore: 1480014000000

[2016/9/24 16:43:17:238]: DNS config expired: 0

[2016/9/24 16:43:17:239]: checkDNS finished

[2016/9/24 16:43:17:239]: EMDNSManager::getHost: type: 2

[2016/9/24 16:43:17:240]: current host: domain: 182.92.159.193 port: 80

[2016/9/24 16:43:17:435]: http response: {

  "action" : "post",

  "application" : "ebd6fef0-813e-11e6-98a6-dddb543bd761",

  "path" : "/users",

  "uri" : "https://a1.easemob.com/忽略/users",

  "entities" : [ {

    "uuid" : "f05bc2e0-8232-11e6-beb1-0de3a4dfada6",

    "type" : "user",

    "created" : 1474706597390,

    "modified" : 1474706597390,

    "username" : "tmp5250",

    "activated" : true

  } ],

  "timestamp" : 1474706597400,

  "duration" : 0,

  "organization" : "忽略",

  "applicationName" : "忽略"

}

fatal error: unexpectedly found nil while unwrapping an Optional value
已邀请:
看起来code为0,就是成功了,登录报错了吗
登录成功了!然后就报错了
崩溃吗,有崩溃到哪一句代码吗
看log日志注册登录没有问题

要回复问题请先登录注册