[英]Inappropriate blocking method call, but Suspend function 'withContext' should be called only from a coroutine or another suspend function
[英]Suspend function 'callGetApi' should be called only from a coroutine or another suspend function
我正在从 onCreate(...) 调用暂停函数
override fun onCreate(savedInstanceState: Bundle?) {
...
...
callGetApi()
}
暂停的功能是:-
suspend fun callGetApi() {....}
但是错误出现了Suspend function 'callGetApi' should be called only from a coroutine or another suspend function
我正在从 onCreate(...) 调用挂起的函数
override fun onCreate(savedInstanceState: Bundle?) {
...
...
callGetApi()
}
并且暂停的功能是:-
suspend fun callGetApi() {....}
但是错误显示挂起函数'callGetApi'应该只从协程或另一个挂起函数调用
我正在从 onCreate(...) 调用挂起的函数
override fun onCreate(savedInstanceState: Bundle?) {
...
...
callGetApi()
}
并且暂停的功能是:-
suspend fun callGetApi() {....}
但是错误显示挂起函数'callGetApi'应该只从协程或另一个挂起函数调用
我正在从 onCreate(...) 调用挂起的函数
override fun onCreate(savedInstanceState: Bundle?) {
...
...
callGetApi()
}
并且暂停的功能是:-
suspend fun callGetApi() {....}
但是错误显示挂起函数'callGetApi'应该只从协程或另一个挂起函数调用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.