Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 2044427

Browse files
committed
Fix potential IOS progress report error #210
1 parent 04dc695 commit 2044427

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

src/ios/RNFetchBlobNetwork.m

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@
3232
NSMutableDictionary * progressTable;
3333
NSMutableDictionary * uploadProgressTable;
3434

35+
__attribute__((constructor))
36+
static void initialize_tables() {
37+
if(expirationTable == nil)
38+
{
39+
expirationTable = [[NSMapTable alloc] init];
40+
}
41+
if(taskTable == nil)
42+
{
43+
taskTable = [[NSMapTable alloc] init];
44+
}
45+
if(progressTable == nil)
46+
{
47+
progressTable = [[NSMutableDictionary alloc] init];
48+
}
49+
if(uploadProgressTable == nil)
50+
{
51+
uploadProgressTable = [[NSMutableDictionary alloc] init];
52+
}
53+
if(cookiesTable == nil)
54+
{
55+
cookiesTable = [[NSMapTable alloc] init];
56+
}
57+
}
58+
59+
3560
typedef NS_ENUM(NSUInteger, ResponseFormat) {
3661
UTF8,
3762
BASE64,
@@ -78,26 +103,6 @@ - (id)init {
78103
taskQueue = [[NSOperationQueue alloc] init];
79104
taskQueue.maxConcurrentOperationCount = 10;
80105
}
81-
if(expirationTable == nil)
82-
{
83-
expirationTable = [[NSMapTable alloc] init];
84-
}
85-
if(taskTable == nil)
86-
{
87-
taskTable = [[NSMapTable alloc] init];
88-
}
89-
if(progressTable == nil)
90-
{
91-
progressTable = [[NSMutableDictionary alloc] init];
92-
}
93-
if(uploadProgressTable == nil)
94-
{
95-
uploadProgressTable = [[NSMutableDictionary alloc] init];
96-
}
97-
if(cookiesTable == nil)
98-
{
99-
cookiesTable = [[NSMapTable alloc] init];
100-
}
101106
return self;
102107
}
103108

0 commit comments

Comments
 (0)