NSString *urlstr = @"http://api.test.com:8080/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(@"absoluteString:%@", url.absoluteString); //完整的url字符串
NSLog(@"relativePath: %@", url.relativePath); //相對路徑 /index.php
NSLog(@"port :%@", url.port); //端口 8080
NSLog(@"path: %@", url.path); //路徑 /index.php
NSLog(@"pathComponents:%@", url.pathComponents); //("/","index.php")
NSLog(@"Query:%@", url.query); //參數 g=api&m=base&a=skyuv&city=110229