Thursday, May 9, 2024
HomeiOS Developmentswift - Unsupported kind error in FirebaseFunctions iOS SDK

swift – Unsupported kind error in FirebaseFunctions iOS SDK


I’ve built-in the Firebase SDK into my iOS app.

My challenge is that when I attempt to name a callable cloud operate passing in a construction occasion or a dictionary with a construction occasion as a worth in a pair, it crashes.

import UIKit
import FirebaseFunctions

class ViewController: UIViewController {
    lazy var features = Capabilities.features()
    
    override func viewDidLoad() {
        tremendous.viewDidLoad()
        
        let encoder = JSONEncoder()
        let merchandise = A(i: "string")
        let encodedItem = strive! encoder.encode(merchandise)
        
        features.httpsCallable(
            "foo"
        ).name([
            "item": encodedItem
        ]) { _, _ in
            
        }
    }
}

struct A: Codable {
    let i: String
}

FirebaseFunctions.SerializerError.unsupportedType

If I do not encode the construction occasion, it crashes in the identical means.

If in name(_:completion:) I move dictionaries with strings, integers or different dictionaries with strings and integers as key values, the app doesn’t crash.

If I move an encoded or a non-encoded A occasion (not a dictionary with a key-value pair during which the encoded A occasion is the worth), the app crashes otherwise:

enter image description here

Is there an answer apart from passing dictionaries as an alternative of Information cases in name(_:completion:)?

Xcode 15.3, iPhone 15 Professional simulator on iOS 17.4
MacBook Air M1 8GB on macOS Sonoma 14.4.1
Firebase iOS SDK 10.22.1



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments