作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试使用 Firebase 中的 MLModelInterpreter 在我的 Xcode 项目中加载 tflite-File 时,在 Launchsreen 完全可见后出现以下错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FIRInstanceIDCheckinPreferences preferencesFromKeychainContents:]: unrecognized selector sent to class 0x10235ca58
import Firebase
var interpreter: ModelInterpreter?
func convertTheModel(){
guard let modelPath = Bundle.main.path( forResource: "model", ofType: "tflite", inDirectory: ""
)
else {
print("not able to load model")
return
}
let localModel = CustomLocalModel(modelPath: modelPath)
interpreter = ModelInterpreter.modelInterpreter(localModel: localModel)
let ioOptions = ModelInputOutputOptions()
do {
try ioOptions.setInputFormat(index: 0, type: .float32, dimensions: [1, 22])
try ioOptions.setOutputFormat(index: 0, type: .float32, dimensions: [1, 1])
} catch let error as NSError {
print("Failed to set input or output format with error: \(error.localizedDescription)")
}
let inputs = ModelInputs()
var inputData = Data()
do {
for _ in 0 ..< 22 {
// require fixed-point values or the original bytes.
var RandomNumber = Float.random(in: 0 ..< 1)
// Append normalized values to Data object.
let elementSize = MemoryLayout.size(ofValue: RandomNumber)
var bytes = [UInt8](repeating: 0, count: elementSize)
memcpy(&bytes, &RandomNumber, elementSize)
inputData.append(&bytes, count: elementSize)
}
try inputs.addInput(inputData)
} catch let error {
print("Failed to add input: \(error)")
}
interpreter!.run(inputs: inputs, options: ioOptions) { outputs, error in
guard error == nil, let outputs = outputs else { return }
print(outputs)
}
}
interpreter = ModelInterpreter.modelInterpreter(localModel: localModel)
/Users/Path/Application_Name/Update/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(VisionExtension.pbobjc_0848a2b53cac8a49ea32ab4e6cb931d4.o)
ld: 46 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code
pod deintegrate
并且比 pod install
platform :ios, '13.0'
target 'My Project' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for My Project
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'GoogleMobileVision/FaceDetector'
pod 'Firebase/Firestore'
pod 'Firebase/MLModelInterpreter'
end
-ObjC
的位置:
最佳答案
-ObjC 必须在应用程序的 Other Linker Flags
中让 Firebase 正常工作。见 https://github.com/firebase/firebase-ios-sdk/issues/4776有关此问题的更多详细信息。
关于ios - 'NSInvalidArgumentException',原因 : '+[FIRInstanceIDCheckinPreferences preferencesFromKeychainContents:]: ' unrecognized selector sent to class ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61168491/
当我尝试使用 Firebase 中的 MLModelInterpreter 在我的 Xcode 项目中加载 tflite-File 时,在 Launchsreen 完全可见后出现以下错误: *** T
我是一名优秀的程序员,十分优秀!