Skip to content

Commit 158c606

Browse files
author
Krzysztof Borowy
committed
fix: bring back tv os support
1 parent 0ba7726 commit 158c606

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ios/RNCAsyncStorage.m

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,19 @@ static void RCTAppendError(NSDictionary *error, NSMutableArray<NSDictionary *> *
9494
}
9595

9696
static NSString *RCTCreateStorageDirectoryPath(NSString *storageDir) {
97-
// We should use the "Application Support/[bundleID]" folder for persistent data storage that's hidden from users
98-
NSString *storageDirectoryPath = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES).firstObject;
99-
storageDirectoryPath = [storageDirectoryPath stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]]; // Per Apple's docs, all app content in Application Support must be within a subdirectory of the app's bundle identifier
100-
storageDirectoryPath = [storageDirectoryPath stringByAppendingPathComponent:storageDir];
97+
NSString *storageDirectoryPath = @"";
98+
99+
#if TARGET_OS_TV
100+
storageDirectoryPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
101+
storageDirectoryPath = [storageDirectoryPath stringByAppendingPathComponent:storageDir];
102+
#else
103+
storageDirectoryPath = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES).firstObject;
104+
// We should use the "Application Support/[bundleID]" folder for persistent data storage that's hidden from users
105+
storageDirectoryPath = [storageDirectoryPath stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]]; // Per Apple's docs, all app content in Application Support must be within a subdirectory of the app's bundle identifier
106+
storageDirectoryPath = [storageDirectoryPath stringByAppendingPathComponent:storageDir];
107+
#endif
108+
109+
101110
return storageDirectoryPath;
102111
}
103112

0 commit comments

Comments
 (0)