Is there an easy way to change the scheme of a NSURL
? I do realize that NSURL
is immutable. My goal is to change the scheme of an URL to \"https\" if t
If you are using iOS 7 and later, you can use NSURLComponents
, as show here
NSURLComponents *components = [NSURLComponents new];
components.scheme = @"http";
components.host = @"joris.kluivers.nl";
components.path = @"/blog/2013/10/17/nsurlcomponents/";
NSURL *url = [components URL];
// url now equals:
// http://joris.kluivers.nl/blog/2013/10/17/nsurlcomponents/