Open iKK001 opened 2 years ago
I found a few problems with this issue:
Can you grab the JSON data and post it here? Feel free to redact any fields, the error is caused only by the structure and not the actual values.
Which json-data do you mean? According to the Firebase Documentation for Function calls in iOS, I have to provide the following:
functions.httpsCallable("addMessage").call(["text": inputField.text]) { result, error in
// ...
}
And this is exactly what I did in my code.
Therefore according to the doc, I have to bring it to the form of ["text": inputField.text]
instead of json format.
You ask me for the json-data. Well, how do I get it ? Or is the documentation wrong ? I don't understand yet.
If still json format is necessary inside the function's call()
method, then can you please post the correct documentation here and update the Firebase-Doc as well ?
Thank you.
I am sorry - my mistake: The Firebase Function was NOT YET DEPLOYED. Therefore it is impossible to work.
Too bad the error message is very much misleading tough.
Probably the right way to fix this is to wrap the JSON deserialization error in another error to provide more context (with the NSUnderlyingError key). The line is here: https://cs.opensource.google/firebase-sdk/firebase-ios-sdk/+/master:FirebaseFunctions/Sources/Functions.swift;l=346
[REQUIRED] Step 1: Describe your environment
Swift Package Manager
httpscallable Function
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
Or with the more modern SwiftUI way (same error, unfortunately as above):
How do I call this function in iOS15.4, using SDK 8.14.0 ????