Change a NSURL's scheme

前端 未结 6 2082
無奈伤痛
無奈伤痛 2021-02-02 09:34

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

6条回答
  •  悲哀的现实
    2021-02-02 10:20

    Perhaps using the resourceSpecifier would help:

    return [[[NSURL alloc] initWithString:[NSString stringWithFormat:@"https:%@", [inURL resourceSpecifier]]]];
    

提交回复
热议问题