iosswiftuialertviewsvprogresshudsialertview

Screen locked after second SIAlertView message and popViewController


When the request failed, SIAlertView shows error message then click the OK button of SIAlertView, popViewController working and there is no problem but when I tried second time and request failed, popViewController working again but there is gray and locked screen. The screen doesn't give any response.

How can I fix this problem? By the way, I am using SVProgressHUD to show and hide loader.

self.showLoader()
showCardViewModel?.generateCard(success: { [weak self] (cardModel) in
    guard let strongSelf = self else { return }
    if let cardModel = cardModel {
        strongSelf.cardModel = cardModel
    }
    self?.cardInfoView.isHidden = false
    self?.bottomView.isHidden = false
    strongSelf.hideLoader()
}, failure: { [weak self] (error) in
    guard let strongSelf = self else { return }
    strongSelf.hideLoader()
    AlertHelper.showAlert(with: AlertType.error,
                             message: error.localizedDescription,
                             delegate: self)
})

Extension Method:

extension ShowCardVC: SIAlertViewDelegate {
    func alertView(_ alertView: SIAlertView!, clickedButtonAt buttonIndex: Int) {
        if let navController = self.navigationController {
            navController.popViewController(animated: true)
        }
    }
}

Solution

  • You should add this control into dismissAnimated method in SIAlertView.m

    if ([SIAlertView sharedQueue].count >= 1) { [SIAlertView hideBackgroundAnimated:YES]; }