Gre*_*r A 2 android kotlin kotlin-coroutines
有人可以告诉我我做错了什么吗
private fun getTorrentsSocketIO() {
coroutineScope.launch {
try {
val socket = IO.socket("...")
socket.on("torrents") {
val jsonString = it.toList() as List<Torrent>
_torrents.value = jsonString
}
socket.connect()
} catch (t: Throwable) {
Log.i("LIST_VIEW_MODEL", t.message.toString())
}
}
}
Run Code Online (Sandbox Code Playgroud)
调用以下方法时会抛出错误
_torrents.value = jsonString
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5845 次 |
| 最近记录: |