I'm trying to implement firebase database with swifts AwaitKit
, which delivers await/async and uses swifts PromiseKit
under hood. The problem is that when I put firebase code inside promise it always fails on NSURLSession
with this error
"NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)"
However http call it self uses https not http. I tried to allow NSAllowsArbitraryLoads
, NSExceptionDomains
nothings helps me. Here is code.
let data: [String: Any] = [
"test": 1,
"test2": "user"
]
let promise: Promise<Bool> = Promise { resolve, reject in
ref.child("test/picks").setValue(data) { err, _ in
if err == nil {
resolve(true)
} else {
reject(err!)
}
}
}
let isStored = try! await(promise)