1转自   http://my.oschina.net/wangdk/blog/165554;


NSURL *url = [NSURL URLWithString:@"http://www.baidu.com/search?id=1"];
2
NSLog(@"scheme:%@", [url scheme]); //协议 http
3
NSLog(@"host:%@", [url host]); //域名 www.baidu.com
4
NSLog(@"absoluteString:%@", [url absoluteString]); //完整的url字符串 http://www.baidu.com:8080/search?id=1
5
NSLog(@"relativePath: %@", [url relativePath]); //相对路径 search
6
NSLog(@"port :%@", [url port]); // 端口 8080
7
NSLog(@"path: %@", [url path]); // 路径 search
8
NSLog(@"pathComponents:%@", [url pathComponents]); // search
9
NSLog(@"Query:%@", [url query]); //参数 id=1

  

NSUrl的打印的更多相关文章

  1. iOS进阶学习-CoreData

    一.CoreData数据库框架的优势 1.CoreData数据持久化框架是Cocoa API的一部分,首次在iOS5版本的系统中出现,它允许按照实体-属性-值模型组织数据,并以XML.二进制文件或者S ...

  2. [BS-27] 创建NSURL的几个方法的区别

    创建NSURL的几个方法的区别     URL的基本格式 = 协议://主机地址/路径 URL和Path的区别 * URL:统一资源定位符,格式 “协议+主机名称+路径”   例如:[NSURL UR ...

  3. 网络编程---(数据请求+slider)将网络上的大文件下载到本地,并打印其进度

    网络编程---将网络上的大文件下载到本地,并打印其进度. 点击"開始传输"button.将网络上的大文件先下载下来,下载完毕后,保存到本地. UI效果图例如以下: watermar ...

  4. NSURL 子串截取

    NSURL *url = [NSURL URLWithString:@"http://reg.email.163.com/unireg/call.do?cmd=register.entran ...

  5. ios开发之--NSURL的用法

    NSURL *url = [NSURL URLWithString:@"http://www.baidu.com/search?id=1"]; NSLog(@"schem ...

  6. iOS UIPrintInteractionController打印

    - (void)printData{ //为打印做准备,创建一个指向sharedPrintController的引用 UIPrintInteractionController *printer = [ ...

  7. NSURL初始化失败

    服务端给返回的网页加载不出来,仔细一看,url是空的!!为什么呢. 示例: NSString *urlStr = @"http://服务器返回带有汉字的url字符串.com"; N ...

  8. NSURL组成部分详解

    手思中有这么一段代码,初看下,让人摸不着头脑 //功能:UIWebView响应长按事件 -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithR ...

  9. ASP.NET MVC5+EF6+EasyUI 后台管理系统(55)-Web打印

    系列目录 前言 1.本次主要弥补工作流,用户表单数据的打印 2.使用JQprint做为web打印插件 3.兼容:FireFox,Chrome,IE. 4.没有依赖也没有配置,使用简单 代码下载:htt ...

随机推荐

  1. 【代码升级】【iCore3 双核心板】例程二十八:FSMC实验——读写FPGA

    实验指导书及代码包下载: http://pan.baidu.com/s/1qXAxwgk iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...

  2. ios-WKWebView 拨打电话

    -(void)webView:(WKWebView* )webView didStartProvisionalNavigation:(WKNavigation* )navigation { NSStr ...

  3. ios-系统警告框 跳转到设置里面

    -(void)createUIAlertIphone:(NSString*)title { UIAlertController * alert =[UIAlertController alertCon ...

  4. linux PPTP VPN客户端安装

    转载于http://www.2cto.com/os/201209/157462.html 下载pptp-1.7.2.tar.gz http://pptpclient.sourceforge.net/ ...

  5. sqlserver临时表操作

    创建临时表        方法一:      create table #临时表名(字段1 约束条件,                       字段2 约束条件,                  ...

  6. 去除行内(inline/inline-block)元素之间的间距

    先展示一下,行内元素之间存在间距,实例代码如下: <style> div { color: #fff; padding: 25px 50px; } .inline-f00 { displa ...

  7. 一些常见maven仓库

    <repositories> <repository> <id>spring-releases</id> <url>https://repo ...

  8. mac 升级vim

    首先,要下载vim的源代码.Vim source archives : vim online,下载7.4的新建一个目录用于安装vim 7.4:sudo mkdir /usr/local进入源代码的sr ...

  9. 学习OpenCV——HOG+SVM

    #include "cv.h" #include "highgui.h" #include "stdafx.h" #include < ...

  10. ZOJ 1015 Fishing Net(弦图判定)

    In a highly modernized fishing village, inhabitants there make a living on fishery. Their major tool ...