Skip to content

Commit 498b617

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

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ios/RNCAsyncStorage.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,18 @@ 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+
#else
102+
// We should use the "Application Support/[bundleID]" folder for persistent data storage that's hidden from users
103+
storageDirectoryPath = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES).firstObject;
104+
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
105+
storageDirectoryPath = [storageDirectoryPath stringByAppendingPathComponent:storageDir];
106+
#endif
107+
108+
101109
return storageDirectoryPath;
102110
}
103111

0 commit comments

Comments
 (0)