title: NSURL URLWithString:relativeToURL: is clipping relative url
body: <p>I'm trying to implement an iOS app, which uses RestKit. In all examples I've seen so far the following code is used to create the URLs:</p>
  
  <pre><code>NSURL *baseURL = [NSURL URLWithString:@"https://api.service.com/v1"];
  NSURL *relativeURL = [NSURL URLWithString:@"/files/search" relativeToURL:baseURL];
  </code></pre>
  
  <p>But then <code>[relativeURL absoluteString]</code> will return <code>https://api.service.com/files/search</code>.</p>
  
  <p>So I tried a few examples:</p>
  
  <pre><code>NSURL *baseURL1 = [NSURL URLWithString:@"https://api.service.com/v1/"];
  NSURL *baseURL2 = [NSURL URLWithString:@"https://api.service.com/v1"];
  NSURL *baseURL3 = [NSURL URLWithString:@"/v1" relativeToURL:[NSURL URLWithString:@"https://api.service.com"]];
  
  NSURL *relativeURL1 = [NSURL URLWithString:@"/files/search" relativeToURL:baseURL1];
  NSURL *relativeURL2 = [NSURL URLWithString:@"/files/search" relativeToURL:baseURL2];
  NSURL *relativeURL3 = [NSURL URLWithString:@"/files/search" relativeToURL:baseURL3];
  NSURL *relativeURL4 = [NSURL URLWithString:@"files/search" relativeToURL:baseURL1];
  NSURL *relativeURL5 = [NSURL URLWithString:@"files/search" relativeToURL:baseURL2];
  NSURL *relativeURL6 = [NSURL URLWithString:@"files/search" relativeToURL:baseURL3];
  
  NSLog(@"1: %@", [relativeURL1 absoluteString]);
  NSLog(@"2: %@", [relativeURL2 absoluteString]);
  NSLog(@"3: %@", [relativeURL3 absoluteString]);
  NSLog(@"4: %@", [relativeURL4 absoluteString]);
  NSLog(@"5: %@", [relativeURL5 absoluteString]);
  NSLog(@"6: %@", [relativeURL6 absoluteString]);
  </code></pre>
  
  <p>And this is the output:</p>
  
  <pre><code>1: https://api.service.com/files/search
  2: https://api.service.com/files/search
  3: https://api.service.com/files/search
  4: https://api.service.com/v1/files/search
  5: https://api.service.com/files/search
  6: https://api.service.com/files/search
  </code></pre>
  
  <p>So the only example returning what I want is #4. Can anyone explain why?</p>