Skip to content

Commit

Permalink
Fix deprecated iOS API stringByAddingPercentEscapesUsingEncoding:
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingrid Wang committed Jan 3, 2024
1 parent 341eeb4 commit cc3db64
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ios/ReactNativeBlobUtil/ReactNativeBlobUtil.mm
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ - (void)presentOptionsMenu:(NSString *)uri
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject
{
NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString * utf8uri = [uri stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSURL * url = [[NSURL alloc] initWithString:utf8uri];
// NSURL * url = [[NSURL alloc] initWithString:uri];
documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
Expand Down Expand Up @@ -818,7 +818,7 @@ - (void)presentOpenInMenu:(NSString *)uri
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject
{
NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString * utf8uri = [uri stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSURL * url = [[NSURL alloc] initWithString:utf8uri];
documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
UIViewController *rootCtrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
Expand Down Expand Up @@ -848,7 +848,7 @@ - (void)presentPreview:(NSString *)uri
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject
{
NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString * utf8uri = [uri stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSURL * url = [[NSURL alloc] initWithString:utf8uri];
// NSURL * url = [[NSURL alloc] initWithString:uri];
documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
Expand Down

0 comments on commit cc3db64

Please sign in to comment.