NSURL cheat sheet

There are lots of various parts of NSURL that you can access through methods, and the documentation on what exactly is included in each of those parts is sparse.  So I have here a cheat sheet that I created that I hope will be useful to others as well:

Based on:

http://user:password@www.test.com:80/somefolder/someapi.php;oneparam;twoparam?somekey=someValue&anotherkey=anotherValue#anchor

absoluteString

http://user:password@www.test.com:80/somefolder/someapi.php;oneparam;twoparam?somekey=someValue&anotherkey=anotherValue#anchor

absoluteURL

http://user:password@www.test.com:80/somefolder/someapi.php;oneparam;twoparam?somekey=someValue&anotherkey=anotherValue#anchor

fragment
anchor

host
www.test.com

lastPathComponent
someapi.php

parameterString
oneparam;twoparam

password
password

path
/somefolder/someapi.php

pathComponents
NSArray – (“/”,somefolder,”someapi.php”)

pathExtension
php

port
80

query
somekey=someValue&anotherkey=anotherValue

relativePath
/somefolder/someapi.php

relativeString

http://user:password@www.test.com:80/somefolder/someapi.php;oneparam;twoparam?somekey=someValue&anotherkey=anotherValue#anchor

resourceSpecifier
//user:password@www.test.com:80/somefolder/someapi.php;oneparam;twoparam?somekey=someValue&anotherkey=anotherValue#anchor

scheme
http

standardizedURL

http://user:password@www.test.com:80/somefolder/someapi.php;oneparam;twoparam?somekey=someValue&anotherkey=anotherValue#anchor

user
user

Share

2 Comments

  • By Cory, January 28, 2014 @ 7:02 pm

    Hey! I recently made an interactive thing similar to this (http://coryalder.github.io/NSURL/). I probably should have just googled and found your cheat sheet first, but it’s too late now ;)

    Best,
    Cory

Other Links to this Post

  1. hyoki's me2day — September 23, 2011 @ 1:10 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

WordPress Themes