9

I'm attempting to create a pull down menu in SwiftUI , the menu seems to be fully visible on the device/simulator and I can interact with it but I get the following message:

[UILog] Called -[UIContextMenuInteraction updateVisibleMenuWithBlock:] while no context menu is visible. This won't do anything.

Can anyone suggest a solution or help me understand the problem ? XCode Version 12.2 beta 4

struct AardvarkQuantity: View {
    
    var body: some View {
        
        VStack{
            Menu(content: {
                
                ForEach((1...5), id: \.self) {
                    Text("\($0)")
                        .font(Font.fontSFProText(size: 9))
                }
                
            }, label: {
                Text("Number of Aardvarks")
                    .font(Font.fontSFProText(size: 12))
                    .foregroundColor(ColorManager.itemRowLabelText)
            })
        }
    }
}
pawello2222
  • 46,897
  • 22
  • 145
  • 209
BobdeBloke
  • 149
  • 1
  • 6
  • 3
    As far as I am aware this is just a debug message and doesn’t actually affect the use of the menu. – Andrew Nov 07 '20 at 23:02
  • Darn it, you're right, the problem with getting the return value was elsewhere - thank. you so much for your prompt responses ! – BobdeBloke Nov 08 '20 at 00:11
  • I got the problem while externalizing the Menu in a custom view. In that case the menu didn't continue to run as expected with a standard touch but with a long pressure. – Luc-Olivier Nov 07 '21 at 10:27

1 Answers1

0

As Andrew and pawello2222 both confirmed, the error message appears to be a log warning and code appears to be working I ended up using the solution listed here.

Although I'm still not clear on how I should respond to the warning.

BobdeBloke
  • 149
  • 1
  • 6
  • for me the message is output to log with a menu that doesn't work correctly. I got this error with a Menu in a composant I created. – Luc-Olivier Nov 06 '21 at 23:02