Open
Description
[REQUIRED] Step 1: Describe your environment
- Xcode version: 13.3
- Firebase SDK version: 8.14.0
- Installation method:
Swift Package Manager
- Firebase Component:
httpscallable Function
- Target platform(s):
iOS15.4
[REQUIRED] Step 2: Describe the problem
Trying to run a httpscallable Function
I get the following error:
Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set. around line 2, column 0." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set. around line 2, column 0., NSJSONSerializationErrorIndex=1}
On Web and Android, the FB-Function runs fine - only on iOS I get the above error message.
Here is my code:
First the more old-fashioned way
functions.httpsCallable("myFBFunctionName").call(["test": "hello"]) { result, error in
if let error = error {
print(error) // see error message above
}
if let data = result?.data as? [String: Any], let text = data["invitationCode"] as? String {
print(text)
}
}
Or with the more modern SwiftUI way (same error, unfortunately as above):
Task {
var functions = Functions.functions()
do {
let result = try await functions.httpsCallable("myFBFunctionName").call(["test": "hello"])
print("result: \(result)")
} catch {
print("error: \(error)") // see error message above
}
}
How do I call this function in iOS15.4, using SDK 8.14.0 ????