mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Apple TV support 1: existing Objective C code should compile for tvOS
Summary: First commit for Apple TV support: changes to existing Objective-C code so that it will compile correctly for tvOS. Closes https://github.com/facebook/react-native/pull/9649 Differential Revision: D3916021 Pulled By: javache fbshipit-source-id: 34acc9daf3efff835ffe38c43ba5d4098a02c830
This commit is contained in:
committed by
Facebook Github Bot 5
parent
339531065f
commit
d368ebfab2
@@ -67,7 +67,11 @@ static NSString *RCTGetStorageDirectory()
|
||||
static NSString *storageDirectory = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
#if TARGET_OS_TV
|
||||
storageDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
|
||||
#else
|
||||
storageDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
|
||||
#endif
|
||||
storageDirectory = [storageDirectory stringByAppendingPathComponent:RCTStorageDirectory];
|
||||
});
|
||||
return storageDirectory;
|
||||
@@ -214,6 +218,10 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
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) {
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:RCTGetStorageDirectory()
|
||||
|
||||
Reference in New Issue
Block a user