无法推断通用参数 'T' - Swift 5.5
Generic parameter 'T' could not be inferred - Swift 5.5
我正在尝试让用户登录,但出现以下错误:
Generic parameter 'T' could not be inferred
这是代码:
// Gets User signed-in
func getUser() async throws -> AuthUser {
do {
try await withUnsafeThrowingContinuation { continuation in
if let user = Amplify.Auth.getCurrentUser() {
continuation.resume(returning: user )
}
}
} catch(let error) {
print(error)
}
}
这是为什么?
其实我的电话本来就不好,应该是这样的:
// Gets User signed-in
func getUser() async throws -> AuthUser {
return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<AuthUser, Error>) in
if let user = Amplify.Auth.getCurrentUser() {
continuation.resume(returning: user)
} else {
signOut()
}
}
}
有关详细信息,请转到 here
我正在尝试让用户登录,但出现以下错误:
Generic parameter 'T' could not be inferred
这是代码:
// Gets User signed-in
func getUser() async throws -> AuthUser {
do {
try await withUnsafeThrowingContinuation { continuation in
if let user = Amplify.Auth.getCurrentUser() {
continuation.resume(returning: user )
}
}
} catch(let error) {
print(error)
}
}
这是为什么?
其实我的电话本来就不好,应该是这样的:
// Gets User signed-in
func getUser() async throws -> AuthUser {
return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<AuthUser, Error>) in
if let user = Amplify.Auth.getCurrentUser() {
continuation.resume(returning: user)
} else {
signOut()
}
}
}
有关详细信息,请转到 here