I am a newbie here, first request. This is called-from and declared inside my viewcontroller class:
func NrangeAlert() {
let alert = NSAlert()
alert.messageText = "N out of range"
alert.informativeText = "use a number between 1 and 92"
alert.alertStyle = .warning
alert.addButton(withTitle: "OK")
alert.runModal()
print("Select a number between 1 and 92")
}
but fails to show the alert. It compiles.
XCode Version 11.3.1 (11C504)
Swift -version
Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
Target: x86_64-apple-darwin19.2.0
It successfully prints to the debugger area.
What am I missing?
Is it a MacOS project ?
I tested, in XCode 11.3, MacOS Mojave inside a MacOS project.
It works.
Do you call NrangeAlert() somewhere in your code ?
Are you sure this line of code is executed ?
Please show code.
It successfully prints to the debugger area.
This can occur only once you have answered the alert. So it must show.
Note: name of func should start with lowercase: nRangeAlert()