Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed bug preventing ASIAuthenticationDialog from being dismissed #295

Merged
merged 1 commit into from

3 participants

George csdillard Joseph Heenan
George

In iOS 5, the ASIAuthenticationDialog could not be dismissed using either the Cancel button or automatically by successfully logging in.
The bug is due to a change in UIViewController in iOS 5. The class & instance "dismiss" methods are using [UIViewController parentViewController] which, as of iOS 5, no longer returns the presenting view controller. A new property called 'presentingViewController' was added in iOS 5 to make up for this.

Changed the class & instance dismiss methods to use the "presentingViewController" property if it is available (iOS 5+). If not, it falls back to the "parentViewController" property.

This bug was previously reported in issue #277. However, it was closed with no explanation by the user that created it.

George gcox Fixed bug preventing ASIAuthenticationDialog from being dismissed
In iOS 5, the ASIAuthenticationDialog could not be dismissed using either the Cancel button or automatically by successfully logging in.
The bug is due to a change in UIViewController in iOS 5.  The class & instance "dismiss" methods are using [UIViewController parentViewController] which, as of iOS 5, no longer returns the presenting view controller.  A new property called 'presentingViewController' was added in iOS 5 to make up for this.

Changed the class & instance dismiss methods to use the "presentingViewController" property if it is available (iOS 5+).  If not, it falls back to the "parentViewController" property.
ba67fc8
csdillard

Just wanted to add another voice in hopes of getting this fixed in the next official version...

The bug mentioned here (and in issue #277, which was incorrectly closed) is still present in version 1.8.1. And the fix mentioned here (using presentingViewController instead of parentViewController on iOS 5 and above) does indeed work.

Joseph Heenan
Collaborator

Thanks for investigating this and submitting a fix!

Joseph Heenan jogu merged commit 9d07768 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 1, 2011
  1. George

    Fixed bug preventing ASIAuthenticationDialog from being dismissed

    gcox authored
    In iOS 5, the ASIAuthenticationDialog could not be dismissed using either the Cancel button or automatically by successfully logging in.
    The bug is due to a change in UIViewController in iOS 5.  The class & instance "dismiss" methods are using [UIViewController parentViewController] which, as of iOS 5, no longer returns the presenting view controller.  A new property called 'presentingViewController' was added in iOS 5 to make up for this.
    
    Changed the class & instance dismiss methods to use the "presentingViewController" property if it is available (iOS 5+).  If not, it falls back to the "parentViewController" property.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 2 deletions.
  1. +8 −2 Classes/ASIAuthenticationDialog.m
10 Classes/ASIAuthenticationDialog.m
View
@@ -216,7 +216,10 @@ - (UITextField *)domainField
+ (void)dismiss
{
- [[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES];
+ if ([sharedDialog respondsToSelector:@selector(presentingViewController)])
+ [[sharedDialog presentingViewController] dismissModalViewControllerAnimated:YES];
+ else
+ [[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES];
}
- (void)viewDidDisappear:(BOOL)animated
@@ -233,7 +236,10 @@ - (void)dismiss
if (self == sharedDialog) {
[[self class] dismiss];
} else {
- [[self parentViewController] dismissModalViewControllerAnimated:YES];
+ if ([self respondsToSelector:@selector(presentingViewController)])
+ [[self presentingViewController] dismissModalViewControllerAnimated:YES];
+ else
+ [[self parentViewController] dismissModalViewControllerAnimated:YES];
}
}
Something went wrong with that request. Please try again.