Created
May 4, 2012 13:20
-
-
Save vargon/2594775 to your computer and use it in GitHub Desktop.
Handling "myscheme" in Objective C
This file contains hidden or 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
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { | |
NSString *scheme = [[[request URL] scheme] lowercaseString]; | |
if([scheme isEqualToString:@"myscheme"]) { | |
// Pull the encoded JSON string out of the querystring | |
// Decode the string, convert JSON string into usable object | |
// Handle the message | |
// Return NO to prevent the webview from navigating | |
return NO; | |
} | |
// Allow normal webview navigation | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment