From c770d4d9e15cf56f653bf85c2c8916df272b90e5 Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Wed, 1 Nov 2023 03:04:59 -0700 Subject: [PATCH] fix(tvos): Apple TV warning should only happen once (#1021) --- packages/default-storage-backend/ios/RNCAsyncStorage.mm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/default-storage-backend/ios/RNCAsyncStorage.mm b/packages/default-storage-backend/ios/RNCAsyncStorage.mm index 342c5ce2..4bfa9458 100644 --- a/packages/default-storage-backend/ios/RNCAsyncStorage.mm +++ b/packages/default-storage-backend/ios/RNCAsyncStorage.mm @@ -155,6 +155,10 @@ static void RCTAppendError(NSDictionary *error, NSMutableArray * static NSString *storageDirectory = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ +#if TARGET_OS_TV + RCTLogWarn( + @"Persistent storage is not supported on tvOS, your data may be removed at any point."); +#endif storageDirectory = RCTCreateStorageDirectoryPath(RCTStorageDirectory); }); return storageDirectory; @@ -499,11 +503,6 @@ - (NSDictionary *)_ensureSetup { RCTAssertThread(RCTGetMethodQueue(), @"Must be executed on storage thread"); -#if TARGET_OS_TV - RCTLogWarn( - @"Persistent storage is not supported on tvOS, your data may be removed at any point."); -#endif - NSError *error = nil; if (!RCTHasCreatedStorageDirectory) { _createStorageDirectory(RCTGetStorageDirectory(), &error);