I am creating a signup screen and using firebase sdk on backend . i have add some if Conditions in my signup form and when ever if a textfield is left empty in form and register button is pressed i am showing a UIAlertView
with a Title,Message and ok Button . but i am seeing a Thread exception while running app which says
Application tried to present modal view controller on itself. Presenting controller is < UIAlertController: 0x7fb750849200>.
and show stack and at the end of error stack it says
libc++abi.dylib: terminating with uncaught exception of type NSException
code for my alertfunction is
func ShowAlert(Title:String,Message:String){
let alert = UIAlertController(title: Title, message: Message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title:"OK", style: UIAlertActionStyle.default, handler: { (action) in
alert.dismiss(animated: true)
}))
alert.present(alert,animated: true)
}
i am feeling is that its some main thread issue but i don't know how to resolve.