Search code examples
iosswiftuipickerviewwatchkit

Picker control methods related to Focus


I have a iOS + Watch app with a UIPicker, and I keep getting logs related to it that I can't figure out related to the Watch app:

[default] -[SPRemoteInterface handlePlistDictionary:fromIdentifier:]:2977: ComF:->Plugin method .pickerFocus is not implemented by the controller (null)

[default] -[SPRemoteInterface handlePlistDictionary:fromIdentifier:]:2977: ComF:->Plugin method .pickerClearFocus is not implemented by the controller (null)

I checked the documentation and the closest thing I could find was just the pickerDidFocus() method, which seems to be talking about general problem area I'm having, but no clear implementation ideas for specifically .pickerClearFocus and .pickerFocus.


Solution

  • I did found a solution for my case (WKInterfaceButton). The button reference outlet and the button sent action outlet must be in the same class. The message is shown when selector outlet references to the view and the action references the view controller.

    Cell :

    class aCellView: NSObject {
      var delegate: WKInterfaceController? = nil
    
      // The action outlet
      @IBAction func doSomeThing() {
        self.delegate!.doSomeThing()
      }
    }
    

    Controller :

    class HomeInterfaceController: WKInterfaceController {
      // ... where you implement your cell
      cell.delegate = self
      // ... where you implement your cell
    }