Skip to content

Commit

Permalink
fix(tvos): Apple TV warning should only happen once (#1021)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglowder authored Nov 1, 2023
1 parent a212a6e commit c770d4d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/default-storage-backend/ios/RNCAsyncStorage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ static void RCTAppendError(NSDictionary *error, NSMutableArray<NSDictionary *> *
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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c770d4d

Please sign in to comment.