Skip to content

Commit c770d4d

Browse files
authored
fix(tvos): Apple TV warning should only happen once (#1021)
1 parent a212a6e commit c770d4d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/default-storage-backend/ios/RNCAsyncStorage.mm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ static void RCTAppendError(NSDictionary *error, NSMutableArray<NSDictionary *> *
155155
static NSString *storageDirectory = nil;
156156
static dispatch_once_t onceToken;
157157
dispatch_once(&onceToken, ^{
158+
#if TARGET_OS_TV
159+
RCTLogWarn(
160+
@"Persistent storage is not supported on tvOS, your data may be removed at any point.");
161+
#endif
158162
storageDirectory = RCTCreateStorageDirectoryPath(RCTStorageDirectory);
159163
});
160164
return storageDirectory;
@@ -499,11 +503,6 @@ - (NSDictionary *)_ensureSetup
499503
{
500504
RCTAssertThread(RCTGetMethodQueue(), @"Must be executed on storage thread");
501505

502-
#if TARGET_OS_TV
503-
RCTLogWarn(
504-
@"Persistent storage is not supported on tvOS, your data may be removed at any point.");
505-
#endif
506-
507506
NSError *error = nil;
508507
if (!RCTHasCreatedStorageDirectory) {
509508
_createStorageDirectory(RCTGetStorageDirectory(), &error);

0 commit comments

Comments
 (0)