dimanche 10 mai 2015

Why are there trailing slashes in NSURL constructed from initWithScheme ...?

When using the NSURL constructor

initWithScheme:(NSString *) host:(NSString *) path:(NSString *)

iOS for some reason appends two extra trailing slashes if the path ends with a slash, unless it's only @"/".

enter image description here

Does anyone know why this is, and if there's a way around it other than composing the url manually with something like

[NSURL URLWithString:[NSString stringWithFormat:@"%@://%@%@", scheme, host, path]];

Aucun commentaire:

Enregistrer un commentaire