From 9db07c8d10d9cee1c0ef8038d2374d2c231a41dc Mon Sep 17 00:00:00 2001 From: Camilo Santos Date: Fri, 23 Feb 2024 09:22:21 -0300 Subject: [PATCH] fix(ios): check directory before call delete (#1066) Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com> --- packages/default-storage/ios/RNCAsyncStorage.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/default-storage/ios/RNCAsyncStorage.mm b/packages/default-storage/ios/RNCAsyncStorage.mm index a099dba9..6b81187b 100644 --- a/packages/default-storage/ios/RNCAsyncStorage.mm +++ b/packages/default-storage/ios/RNCAsyncStorage.mm @@ -250,7 +250,10 @@ static dispatch_queue_t RCTGetMethodQueue() NSError *error; [[NSFileManager defaultManager] removeItemAtPath:RCTGetStorageDirectory() error:&error]; RCTHasCreatedStorageDirectory = NO; - return error ? RCTMakeError(@"Failed to delete storage directory.", error, nil) : nil; + if (error && error.code != NSFileNoSuchFileError) { + return RCTMakeError(@"Failed to delete storage directory.", error, nil); + } + return nil; } static NSDate *RCTManifestModificationDate(NSString *manifestFilePath)