jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

Crash on device with iOS 10 (Xcode 9) when hiding instance of MBProgressHUD #511

Open RamiroRamirez opened 6 years ago

RamiroRamirez commented 6 years ago

Hi Matej. First of all, I wanna thank you for this very useful library you made.

In the last days, I have encountered a crash using devices with iOS 10 and compiling the project with Xcode 9 (specifically Version 9.1 (9B55)). The issue happens when you hide one instance of MBProgressHUD. My code looks like this:

fileprivate func clearCache(_ alertAction: UIAlertAction) {

   let progressHUD = MBProgressHUD.showAdded(to: self.view, animated: true)
   dataBase.clearCache { [weak self] in
        self?.performBlock(inMainThread: {
             progressHUD.hide(animated: true)
    })

        ...
    }
}

I am double checking that the hide function is being done in main thread. I get a EXC_BAD_ACCESS highlighting my app delegate line:

screen shot 2017-11-20 at 17 33 09

The thread stack looks like this: screen shot 2017-11-20 at 17 30 03

I do not get any other information.

On simulator everything seems to work well, but on devices (5 SE and iPad with ios 10 both) the app crash.

Last week we found a solution for one instance of UIAlertActivityView (used in tableview background) that was crashing our app the same way I described (also iOS 10). The line who did the trick was:

spinner.hidesWhenStopped = false

this property is true per default.

Hope all this information is helpful to be able to reproduce/fix the issue. Happy coding!!