NSURL Reference Chart

I work with NSURL from time to time and invariably need a chart to remind me what the class provides in the form of helpers. I tend to write something like the following to refresh my memory.

[snippet id=”27″]

Here’s a couple of handy charts to help you decide which property to use.

File URLs (nulls removed)

NSURL PropertyFile Value
- (NSString *)absoluteStringfile:///Users/you/Library/Application%20Support/iPhone%20Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf
- (NSURL *)absoluteURLfile:///Users/you/Library/Application%20Support/iPhone%20Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf
- (const char *) fileSystemRepresentation/Users/you/Library/Application Support/iPhone Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf
- (NSString *)lastPathComponentMobileHIG.pdf
- (NSString *)path/Users/you/Library/Application Support/iPhone Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf
- (NSArray *)pathComponents(
"/",
Users,
you,
Library,
"Application Support",
"iPhone Simulator",
"7.0.3",
Applications,
GUID,
Library,
Content,
"MobileHIG.pdf"
)
- (NSString *)pathExtensionpdf
- (NSString *)relativePath/Users/you/Library/Application Support/iPhone Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf
- (NSString *)relativeStringfile:///Users/you/Library/Application%20Support/iPhone%20Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf
- (NSString *)resourceSpecifier/Users/you/Library/Application%20Support/iPhone%20Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf
- (NSString *)schemefile
- (NSURL *)standardizedURLfile:///Users/you/Library/Application%20Support/iPhone%20Simulator
/7.0.3/Applications/GUID/Library/Content/MobileHIG.pdf

Internet URLs (nulls removed)

NSURL PropertyInternet Value
- (NSString *)absoluteStringhttp://blog.canispater.com:80/2013/11/nsurl-reference-chart/?pg=1&other=value
- (NSURL *)absoluteURLhttp://blog.canispater.com:80/2013/11/nsurl-reference-chart/?pg=1&other=value
- (NSString *)hostblog.canispater.com
- (NSString *)lastPathComponentnsurl-reference-chart
- (NSString *)path/2013/11/nsurl-reference-chart
- (NSArray *)pathComponents(
"/",
2013,
11,
"nsurl-reference-chart"
)
- (NSNumber *)port80
- (NSString *)querypg=1&other=value
- (NSString *)relativePath/2013/11/nsurl-reference-chart
- (NSString *)relativeStringhttp://blog.canispater.com:80/2013/11/nsurl-reference-chart/?pg=1&other=value
- (NSString *)resourceSpecifier//blog.canispater.com:80/2013/11/nsurl-reference-chart/?pg=1&other=value
- (NSString *)schemehttp
- (NSURL *)standardizedURLhttp://blog.canispater.com:80/2013/11/nsurl-reference-chart/?pg=1&other=value

Helpful? Anyone? Anyone?