From 85a042e607ca8adc696e435a780c82e4c0fbda5d Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Tue, 31 Oct 2023 02:22:02 -0700 Subject: [PATCH] [tvOS] Apple TV warning should only happen once --- 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);