Search code examples
iosswifttensorflow2.0coremltensorflow-lite

Use of unresolved identifier 'CoreMLDelegate' - TFLite


I am using https://github.com/sunkeunchoi/posenet-ios to play around with PoseNet and TensorFlowLite, but I keep getting a build fail message when I try to run it: Use of unresolved identifier 'CoreMLDelegate' for CoreMLDelegate() (see code below). I did not change anything from the code after downloading it.
When I commented out the CoreMLDelegate() swift, the app started working but I would like to solve the issue. Could you try to download it and see if you have the same problem as me ?

    switch delegate {
    case .Metal:
      delegates = [MetalDelegate()]
    case .CoreML:
        if let coreMLDelegate = CoreMLDelegate() {
        delegates = [coreMLDelegate]
      } else {
        delegates = nil
      }
    default:
      delegates = nil
    }```


Solution

  • Looks like you are looking at a user fork of the official PoseNet example app.

    Please use the official version, which can be found here: https://github.com/tensorflow/examples/tree/master/lite/examples/posenet/ios

    You can clone the entire tensorflow/examples repository, run pod install, and open the PoseNet.xcworkspace to build the app.

    git clone https://github.com/tensorflow/examples
    cd examples/lite/examples/posenet/ios
    pod install --repo-update
    open PoseNet.xcworkspace   # This should open your Xcode.