When called +[NSURL URLWithString:], I have two options for creating my URLs:
[[@"http://example.com" stringByAppendingPathComponent:@"foo"] stringByAppendingPathComponent:@"bar"]
or
[@"http://example.com" stringByAppendingFormat:@"/%@/%@",@"foo",@"bar"];
-[NSString stringByAppendingPathComponent:]seems like a more correct answer, but am I losing anything using -[NSString stringByAppendingFormat:], in addition to handling double slashes, as in the following case?
[[@"http://example.com/" stringByAppendingPathComponent:@"/foo"] stringByAppendingPathComponent:@"bar"]
[@"http://example.com/" stringByAppendingFormat:@"/%@/%@",@"foo",@"bar"];
source
share