0

Following some excellent advice given here, I handle validateMenuItem by comparing the menu items action to strings - that way you can change the tag or text of the menu and it still works. Well, until today, when the latest Xcode update spits out this error:

No method declared with Objective-C selector 'toggleHidden'

In this code...

override func validateMenuItem(menuItem: NSMenuItem) -> Bool {
    let c = selectedCards().count

    switch menuItem.action {
    case "toggleHidden": if c == 1 { if selectedCard()!.info["hidden"] ?? "false" == true { return true } else { return false } }
    case "toggleIgnore": if c == 1 { if selectedCard()!.info["ignore"] ?? "false" == true { return true } else { return false } }           
    default: return true
    }
    return true
}

The funny thing is, this is literally the next bit of code...

@IBAction func toggleHidden(sender: NSObject) {
     ...
}

Now I know that the items in action are actually selectors, so I tried this...

case Selector("toggleHidden"):

That compiles fine but returns the same error.

This was working fine before the update, does anyone have an idea why it might be spitting the error now?

Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98

0 Answers0