it may be very easy, but I don\'t seems to find out why is URLWithString:
returning nil here.
//localisationName is a arbitrary string here
NSSt
I think your accented characters are throwing things off; they won't be handled by -stringByAddingPercentEscapesUsingEncoding:.
UPDATE:
Since stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding
is deprecated now, you should use stringByAddingPercentEncodingWithAllowedCharacters
[stringURL stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
Here's the list of allowed characters set depending on your case.
+ (NSCharacterSet *)URLUserAllowedCharacterSet;
+ (NSCharacterSet *)URLPasswordAllowedCharacterSet;
+ (NSCharacterSet *)URLHostAllowedCharacterSet;
+ (NSCharacterSet *)URLPathAllowedCharacterSet;
+ (NSCharacterSet *)URLQueryAllowedCharacterSet;
+ (NSCharacterSet *)URLFragmentAllowedCharacterSet;
Reference: https://developer.apple.com/reference/foundation/nsstring/1411946-stringbyaddingpercentencodingwit