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
NSString *newUrlString = [NSString stringWithFormat:@"https://%@%@",
inURL.host, inURL.path];
if (inURL.query) {
newUrlString = [newUrlString stringByAppendingFormat:@"?%@", inURL.query];
}
return [NSURL URLWithString:newUrl];
[NOTE] Code related to port and other fields handling are removal for simplicity.