When I try to run a Firebase Function from Swift, I get an error saying:
Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
This is the Firebase Function:
exports.helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!")
})
This is my Swift code:
Functions.functions().httpsCallable("helloWorld").call { (result, error) in
if error == nil {
print("Success: \(result?.data)")
} else {
print(error.debugDescription)
}
}