Skip to content

Commit

Permalink
Merge pull request #17 from DaGaMs/master
Browse files Browse the repository at this point in the history
Fixed a crash when the UIWebView fails to load with an error
  • Loading branch information
mcglincy committed Jul 8, 2012
2 parents 5d8a90b + f856f59 commit ac55f61
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions evernote-sdk-ios/internal/ENOAuthViewController.m
Expand Up @@ -26,6 +26,7 @@ @implementation ENOAuthViewController
- (void)dealloc
{
self.delegate = nil;
[self.webView stopLoading];
[_authorizationURL release];
[_oauthCallbackPrefix release];
[_webView release];
Expand Down Expand Up @@ -70,17 +71,7 @@ - (void)cancel:(id)sender
if (self.delegate) {
[self.delegate oauthViewControllerDidCancel:self];
}
}

- (void)viewDidUnload
{
[super viewDidUnload];

// Release any retained subviews of the main view.

self.webView.delegate = nil;
[self.webView stopLoading];
[_webView release];
self.delegate = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
Expand All @@ -97,6 +88,13 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
return;
}

if (error.code == NSURLErrorCancelled) {
// ignore rapid repeated clicking
return;
}

[self.webView stopLoading];

if (self.delegate) {
[self.delegate oauthViewController:self didFailWithError:error];
}
Expand Down

0 comments on commit ac55f61

Please sign in to comment.