NSString *urlstr = @"http://api.test.com:8080/test/index.php?g=api&m=base&a=skyuv&city=110229";
NSURL *url = [NSURL URLWithString:urlstr];
NSLog(@"scheme:%@", url.scheme); //协议 http
NSLog(@"host:%@", url.host); //域名 api.test.com
NSLog(@"port:%@", url.port); //端口 8080
NSLog(@"absoluteString:%@", url.absoluteString); //完整的url字符串
NSLog(@"relativePath: %@", url.relativePath); //相对路径 /test/index.php
NSLog(@"path: %@", url.path); //路径 /test/index.php
NSLog(@"pathComponents:%@", url.pathComponents); //("/",test,"index.php")
NSLog(@"Query:%@", url.query); //参数 g=api&m=base&a=skyuv&city=110229