Update deprecated stringByAddingPercentEscapesUsingEncoding to NSCharacterSet (#39638)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39638

# Changelog:
[Internal] - Removing usage of stringByAddingPercentEscapesUsingEncoding

Per deprecation message:

> 'stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.

Reviewed By: cipolleschi

Differential Revision: D49610243

fbshipit-source-id: 7c40ce9f6b643851c8aae8149acde2c435c06a76
This commit is contained in:
Ingrid Wang 2023-09-26 10:26:06 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 91d3a9539d
Коммит 6b3d25a075
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -64,7 +64,8 @@ inline static NSURL *NSURLFromImageSource(const facebook::react::ImageSource &im
if ([urlString rangeOfString:@":"].location != NSNotFound) {
// The URL has a scheme.
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
urlString =
[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
url = [NSURL URLWithString:urlString];
return url;
}