【发布时间】:2020-10-22 21:52:38
【问题描述】:
我尝试将异步 Kotlin 方法的结果存储到变量中。
Amplify.Auth.fetchAuthSession(
{result ->
Log.i(TAG, "Amplify: Fetch Auth Session $result")
isAuthenticated = result.isSignedIn
},
{error ->
Log.e(TAG , "Amplify: Fetch Auth Session $error")
}
)
if (isAuthenticated == true) {
[...]
我真的不知道如何将result.isSignedIn 设置为isAuthenticated 变量,以便我可以在闭包之外使用它。我在 stackoverflow 上发现了一个类似的问题,但它并没有帮助我。
有人可以帮助我吗?!
【问题讨论】:
-
也许this 就是您要找的东西?
标签: android kotlin asynchronous