Xcode Object-C NSUrl to NSString

In Object-C to convert back and forth from NSUrl and NSString take a look at this example:

NSString *urlstring = [NSString stringWithFormat:@"http://spacetech.dk"];
NSURL *url = [NSURL URLWithString:urlstring];
NSLog(@"url = %@",url);

This will first save a NSString, then create a NSUrl from the String, and last output the NSUrl in the log

Tagged with: , ,