1

I am having a problem by my UIAlertView. I am using a NSTimer for showing an UIAlertView on a moment when my loop is done.

The problem:

My UIAlertView is popping up on my previous ViewController when I am pressing the back button fast, before the loop is done. So on that moment when the UIAlertView is showing up, my app will crash when pressing a button on the UIAlertView.

How can I check that the ViewController is still the delegate or something that it does not show up in an other view?

Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
  • possible duplicate of [UIAlertView crash issue on another view controller](http://stackoverflow.com/questions/23509441/uialertview-crash-issue-on-another-view-controller) – Sanoj Kashyap Jun 09 '14 at 09:25

1 Answers1

0

It is crashing because you have set the current View controller as delegate and while pressing back that is no more in memory when alert appears on the previous view while pressing back at the time the reference which delegate is handling is no more that why it is crashing.

UIAlertView crash issue on another view controller

Community
  • 1
  • 1
Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75
  • Oke yeah, I understand that, but then how can I check that i does not show up in the other view? – Kets Jun 09 '14 at 09:26
  • you can check for class reference. – Sanoj Kashyap Jun 09 '14 at 09:27
  • That answer is for handeling the "crash" so it will still show up in the other view controller. I do not want it to show there. Just a check for, are we still in the delegate class or something –  Jun 09 '14 at 10:03
  • this might help you-http://stackoverflow.com/questions/5399219/ios-dismiss-uialertview-beforing-showing-another – Sanoj Kashyap Jun 09 '14 at 10:06