Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +(void)baseUrls {
- NSArray *requestURLs = @[@"/api/v3.1/User/Page/",
- @"api/v3.1/User/Page",
- @"/api/v3.1/User/Page/",
- @"/api/v3.1/Follow/Page",
- @"/api/v3.1/User/Follow",
- @"/api/v3.1/User/Page",
- @"api/v3.2/User/Page",
- @"api/v3.2/User/Page/aaa/bbb"];
- NSURL *baseURL = [NSURL URLWithString:@"http://appgateway.xxx.xx-xxx.xxx.com/"];
- for (NSString *aRequestURL in requestURLs) {
- NSURL *constructedURL = [NSURL URLWithString:aRequestURL relativeToURL:baseURL];
- if (constructedURL) {
- NSLog(@"Success: %@", constructedURL.absoluteString);
- } else {
- NSLog(@"Error : %@ + %@", baseURL.absoluteString, aRequestURL);
- }
- }
- //WORKS
- NSURL *hardCoded = [NSURL URLWithString:@"/api/v3.1/Follow/Page" relativeToURL:baseURL];
- NSLog(@"HardCoded: %@", hardCoded.absoluteString);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement