Tuesday, April 30, 2013

NSURL fragment example ios

fragment
Returns the fragment of a URL conforming to RFC 1808.
- (NSString *)fragment
Return Value of [NSURL fragment]
The fragment of the URL. If the receiver does not conform to RFC 1808, returns nil.
Example of [NSURL fragment]
NSString *fragment = [webView.request.URL fragment];
Example of [NSURL fragment]
NSString *url_ = @"foo://name.com:8080/12345;param?foo=1&baa=2#fragment";
NSURL *url = [NSURL URLWithString:url_];

NSLog(@"scheme: %@", [url scheme]); 
NSLog(@"host: %@", [url host]); 
NSLog(@"port: %@", [url port]);     
NSLog(@"path: %@", [url path]);     
NSLog(@"path components: %@", [url pathComponents]);        
NSLog(@"parameterString: %@", [url parameterString]);   
NSLog(@"query: %@", [url query]);       
NSLog(@"fragment: %@", [url fragment]);