Created
September 24, 2010 13:37
-
-
Save kwylez/595379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)webViewDidFinishLoad:(UIWebView *)webView { | |
/** | |
* Since there are a lot redirects then UIWebview delegate methods are called ALOT. | |
* Therefore I just want to check and make sure that I am only getting the value when the url has my hostname in it | |
*/ | |
NSRange rangeRound = [[[webView.request URL] absoluteString] rangeOfString:@"corywiles"]; | |
if (rangeRound.length) { | |
NSString *authToken = [[webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('token').innerHTML"] | |
stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
NSLog(@"authToken: %@", authToken); | |
} else { | |
NSLog(@"no auth token"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment