I am trying to add Google MLKit Translate into my SwiftUI Project. I am already using firebase via SPM and only after the initial launch get this error: -[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x600001afa700
Here is my code:
App Delegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
FirebaseApp.configure()
...
let spanishRemoteTranslator = TranslateRemoteModel.translateRemoteModel(language: .spanish)
if ModelManager.modelManager().isModelDownloaded(spanishRemoteTranslator) {
print("Spanish Translator Downloaded")
}else {
print("Downloading Spanish Translator")
ModelManager.modelManager().download(spanishRemoteTranslator, conditions: ModelDownloadConditions(allowsCellularAccess: true, allowsBackgroundDownloading: true))
}
return true
}
Then I call it like so:
if ModelManager.modelManager().isModelDownloaded(spanishModel) {
Translator.translator(options: englishSpanishTranslator).translate(buis.name!) { translatedText, error in
if error == nil {
if let translatedText = translatedText {
name = translatedText
}else {
print("error = \(error)")
}
}else {
print("error = \(error)")
}
}
}else {
print("error = Spanish not downloaded")
}
I have also tried using the built in FirebaseMLKitDownload and that doesn't have translator. What is going on?