Skip to content

Commit 94544ac

Browse files
committed
2 parents 9818faa + 406ca5b commit 94544ac

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

ios/MMKVStorage.m

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ @implementation MMKVStorage
1818

1919
const int DATA_TYPE_ARRAY = 5;
2020

21-
21+
static dispatch_queue_t RCTGetMethodQueue()
22+
{
23+
static dispatch_queue_t queue;
24+
static dispatch_once_t onceToken;
25+
dispatch_once(&onceToken, ^{
26+
queue = dispatch_queue_create("MMKVStorage.Queue", DISPATCH_QUEUE_SERIAL);
27+
});
28+
return queue;
29+
}
2230

2331
MMKV *mmkv;
2432
SecureStorage *secureStorage;
@@ -30,7 +38,7 @@ @implementation MMKVStorage
3038

3139
- (dispatch_queue_t)methodQueue
3240
{
33-
return dispatch_get_main_queue();
41+
return RCTGetMethodQueue();
3442
}
3543

3644
- (id)init
@@ -49,7 +57,7 @@ - (id)init
4957

5058
+ (BOOL)requiresMainQueueSetup
5159
{
52-
return NO;
60+
return YES;
5361
}
5462

5563
#pragma mark setupWithEncryption
@@ -536,4 +544,3 @@ -(void) encryptionHandler:(NSString *)ID
536544

537545
@end
538546

539-

0 commit comments

Comments
 (0)