29 Foundation框架之NSURL
来源:互联网 发布:左耳最后说了什么 知乎 编辑:程序博客网 时间:2024/06/03 10:20
29 Foundation框架之NSURL
Tags: Objective-C
NSURL代表了互联网上的一个文件的统一资源定位符。其格式如下:
schema://host:port/path
如http://www.abc.com:8080/index.php中,scheme为http,host为www.abc.com,port为8080,而path为/index.php。
NSURLTest.m
#import <Foundation/Foundation.h>int main(int argc, const char * argv[]) { @autoreleasepool { //创建NSURL对象 NSURL *url = [NSURL URLWithString:@"http://www.crazyit.org/index.php"]; //获取NSURL对象的scheme NSLog(@"url的schema为:%@", [url scheme]); //获取NSURL对象的host NSLog(@"url的host为:%@", [url host]); //获取NSURL对象的port NSLog(@"url的port为:%@", [url port]); //获取NSURL对象的path NSLog(@"url的path为:%@", [url path]); } return 0;}
运行结果为:
url的schema为:httpurl的host为:www.crazyit.orgurl的port为:(null)url的path为:/index.php
0 0
- 29 Foundation框架之NSURL
- Foundation框架之NSString
- Foundation框架之NSArray
- Foundation框架之NSArray
- Foundation框架之NSDictionary
- iOS 之 Foundation 框架
- IOS之Foundation框架
- 黑马程序员——Foundation框架入门:NSString,NSArray,NSDictionary和NSURL
- Foundation框架,数组---之二
- OC之Foundation框架NSSet
- Foundation框架之字符串对象
- Foundation框架篇之NSNumber
- Foundation框架之结构体
- Objective-C之Foundation框架
- OC之Foundation框架使用
- OC系列之Foundation框架
- Foundation框架之文件操作
- 23 Foundation框架之NSPredicate
- 25 Foundation框架之NSFileManager
- 26 使用NSPathUtilities.h管理路径
- BMP位图信息·DIB结构
- 27 Foundation框架之NSProcessInfo
- 28 Foundation框架之NSFileHandle
- 29 Foundation框架之NSURL
- 30 Foundation框架之NSKeyedArchiver和NSKeyedUnarchiver
- EventBus使用详解
- HDU-2086(推一下公式)
- mac androidstudio 无法连接魅蓝手机进行调试
- Parcelable接口的使用
- 监听器(Listener)学习
- LeetCode OJ 系列之118 Pascal's Triangle --Python
- LeetCode OJ 系列之73 Set Matrix Zeroes --Python