I created a "Pop Up Button" following the WWDC video here:
"Build interfaces with style" https://developer.apple.com/videos/play/wwdc2021/10196/?time=602
After adding the pop up button like shown in the video, I created an IBAction function like this:
@IBAction func onLanguageSelected(_ sender: Any?) {
print("menu selection updated!")
}
Then, I hook up the two menu items to this IBAction function like this:
Build was successful, at runtime, upon click on the button, the app crashed, and throws the following exception:
Assertion failure in -[UIMenu establishInitialDefaultSingleSelection], UIMenu.m:535 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Menu does not have a valid element for default selection'
Why do I this exception? What needs to be fixed here?



You need to add menu items to the Pop Up Button like: