Created
July 16, 2019 06:37
-
-
Save hanfengs/d589f69e098e1b36bc884356e48df321 to your computer and use it in GitHub Desktop.
[NSURL 的解析和编码]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://quxue-data.oss-cn-beijing.aliyuncs.com/scene_course/reading/baowei/reading12-3-73.json | |
NSURL *url = [NSURL URLWithString:jsonUrl]; | |
NSLog(@"Scheme: %@", [url scheme]);//https | |
NSLog(@"Host: %@", [url host]);//https | |
NSLog(@"Port: %@", [url port]);//null | |
NSLog(@"Path: %@", [url path]);//scene_course/reading/baowei/reading12-3-73.json | |
NSLog(@"Relative path: %@", [url relativePath]);//scene_course/reading/baowei/reading12-3-73.json | |
/* | |
Path components as array: ( | |
"/", | |
"scene_course", | |
reading, | |
baowei, | |
"reading12-3-73.json" | |
) | |
*/ | |
NSLog(@"Path components as array: %@", [url pathComponents]); | |
NSLog(@"Parameter string: %@", [url parameterString]);//null | |
NSLog(@"Query: %@", [url query]);//null | |
NSLog(@"Fragment: %@", [url fragment]);//null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment