Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CXAlertView dismiss] bug #25

Open
catskytw opened this issue Jun 5, 2014 · 2 comments
Open

[CXAlertView dismiss] bug #25

catskytw opened this issue Jun 5, 2014 · 2 comments

Comments

@catskytw
Copy link

catskytw commented Jun 5, 2014

Dear,
There is a bug after invoking [youCXAlertView dismiss], please see the detail below.

In the screenshot, you could see that there is still a CXAlertView on the top layer
receiving all touch events after invoking [youCXAlertView dismiss], which hangs up the app just like blocking the main-thread.

Revision:

My revision is 2014/03/28, downloaded from git repo directly.

Reproduce steps:

  1. press OK to login. The CXAlertView doesn't execute [cxAlertView dismiss] because giving by a wrong password.
  2. press Cancel.

Here is my code:

- (void)showLoginDialog:(NASServer *)targetNAS withResultBlock:(void(^)(BOOL success, NSError *e))loginResult{
    NSString *bundleName = @"ASViewController";
    ASViewController *loginViewController =[[[NSBundle mainBundle] loadNibNamed:bundleName
                                                                          owner:self
                                                                        options:nil] objectAtIndex:0];

    loginViewController.loginResultBlock = loginResult;
    loginViewController.targetNASServer = targetNAS;
    [CXAlertView showContentViewAlert:NSLocalizedString(@"PwdConfirm", nil)
                      withActionTitle:NSLocalizedString(@"OK", nil)
                      withContentView:loginViewController
                    withActionHandler:^(CXAlertView *alert, CXAlertButtonItem *btn){
                        QNVideoStationAPIManager *videoStation = [QNAPCommunicationManager share].videoStationManager;
                        [videoStation authLogin:loginViewController.usernameField.text
                                   withPassword:loginViewController.passwordField.text
                               withSuccessBlock:^(RKObjectRequestOperation *o, RKMappingResult *r){
                                   [alert dismiss];
                                   loginResult(YES, nil);
                               }
                               withFailureBlock:^(RKObjectRequestOperation *o, NSError *error){
                                   loginResult(NO, error);
                               }];
                    }];
}

+ (CXAlertView *)showContentViewAlert:(NSString *)title withActionTitle:(NSString *)actionTitle withContentView:(UIView *)contentView withActionHandler:(void(^)(CXAlertView *alert, CXAlertButtonItem *btn))cxHandler{
    CXAlertView *alert = [[CXAlertView alloc] initWithTitle:title
                                                contentView:contentView
                                          cancelButtonTitle:NSLocalizedString(@"Cancel", nil)];
    if (actionTitle != nil) {
        [alert addButtonWithTitle:actionTitle
                             type:CXAlertViewButtonTypeCustom
                          handler:^(CXAlertView *_alert, CXAlertButtonItem *btn){
                              cxHandler(_alert, btn);
                          }];
    }

    alert.cancelButtonFont = [UIFont systemFontOfSize:18.0f];
    alert.customButtonFont = [UIFont boldSystemFontOfSize:18.0f];
    alert.cancelButtonColor = [UIColor colorWithHexString:@"007aff" alpha:1.0f];
    alert.customButtonColor = [UIColor colorWithHexString:@"007aff" alpha:1.0f];

    [alert show];

    alert.showBlurBackground = NO;
    return alert;
}

2014-06-05 2 47 13

@catskytw
Copy link
Author

catskytw commented Jun 5, 2014

The workaround is to add [self.alertWindow setHidden:YES]; as the last line in [CXAlertView dismissWithCleanup:]

It worked for me! :-)

@jlubeck
Copy link

jlubeck commented Aug 29, 2014

@catskytw fix doesn't fix it for me... any other idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants