Skip to content

Commit 40b26e0

Browse files
committed
fix(ios): error reporting details
1 parent 7179426 commit 40b26e0

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

example/ios/FileAccessExample.xcodeproj/project.pbxproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@
580580
GCC_PREPROCESSOR_DEFINITIONS = (
581581
"DEBUG=1",
582582
"$(inherited)",
583+
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
583584
);
584585
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
585586
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -606,6 +607,11 @@
606607
"-DFOLLY_MOBILE=1",
607608
"-DFOLLY_USE_LIBCPP=1",
608609
);
610+
OTHER_LDFLAGS = (
611+
"$(inherited)",
612+
"-Wl",
613+
"-ld_classic",
614+
);
609615
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
610616
SDKROOT = iphoneos;
611617
};
@@ -647,6 +653,10 @@
647653
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
648654
GCC_C_LANGUAGE_STANDARD = gnu99;
649655
GCC_NO_COMMON_BLOCKS = YES;
656+
GCC_PREPROCESSOR_DEFINITIONS = (
657+
"$(inherited)",
658+
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
659+
);
650660
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
651661
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
652662
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -670,6 +680,11 @@
670680
"-DFOLLY_MOBILE=1",
671681
"-DFOLLY_USE_LIBCPP=1",
672682
);
683+
OTHER_LDFLAGS = (
684+
"$(inherited)",
685+
"-Wl",
686+
"-ld_classic",
687+
);
673688
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
674689
SDKROOT = iphoneos;
675690
VALIDATE_PRODUCT = YES;

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
},
1212
"dependencies": {
1313
"react": "18.2.0",
14-
"react-native": "0.71.8"
14+
"react-native": "0.71.15"
1515
},
1616
"devDependencies": {
1717
"@babel/core": "^7.20.0",
1818
"@babel/preset-env": "^7.20.0",
1919
"@babel/runtime": "^7.20.0",
2020
"babel-plugin-module-resolver": "^4.1.0",
21-
"metro-react-native-babel-preset": "0.73.9"
21+
"metro-react-native-babel-preset": "0.73.10"
2222
}
2323
}

ios/FileAccess.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class FileAccess : NSObject {
7777
try FileManager.default.copyItem(atPath: source.path(), toPath: target.path())
7878
resolve(nil)
7979
} catch {
80-
reject("ERR", "Failed to copy '\(source)' to '\(target)'.", error)
80+
reject("ERR", "Failed to copy '\(source)' to '\(target)'. \(error.localizedDescription)", error)
8181
}
8282
}
8383
}
@@ -94,7 +94,7 @@ public class FileAccess : NSObject {
9494
try FileManager.default.copyItem(atPath: assetPath, toPath: target.path())
9595
resolve(nil)
9696
} catch {
97-
reject("ERR", "Failed to copy '\(asset)' to '\(target)'.", error)
97+
reject("ERR", "Failed to copy '\(asset)' to '\(target)'. \(error.localizedDescription)", error)
9898
}
9999
}
100100
}
@@ -136,7 +136,7 @@ public class FileAccess : NSObject {
136136
"internal_total": stat[.systemSize]
137137
])
138138
} catch {
139-
reject("ERR", "Failed to stat filesystem.", error)
139+
reject("ERR", "Failed to stat filesystem. \(error.localizedDescription)", error)
140140
}
141141
}
142142
}
@@ -222,7 +222,7 @@ public class FileAccess : NSObject {
222222
do {
223223
try resolve(FileManager.default.contentsOfDirectory(atPath: path.path()))
224224
} catch {
225-
reject("ERR", "Failed to list '\(path)'.", error)
225+
reject("ERR", "Failed to list '\(path)'. \(error.localizedDescription)", error)
226226
}
227227
}
228228
}
@@ -234,7 +234,7 @@ public class FileAccess : NSObject {
234234
try FileManager.default.createDirectory(atPath: path.path(), withIntermediateDirectories: true, attributes: nil)
235235
resolve(path)
236236
} catch {
237-
reject("ERR", "Failed to create directory '\(path)'.", error)
237+
reject("ERR", "Failed to create directory '\(path)'. \(error.localizedDescription)", error)
238238
}
239239
}
240240
}
@@ -247,7 +247,7 @@ public class FileAccess : NSObject {
247247
try FileManager.default.moveItem(atPath: source.path(), toPath: target.path())
248248
resolve(nil)
249249
} catch {
250-
reject("ERR", "Failed to rename '\(source)' to '\(target)'.", error)
250+
reject("ERR", "Failed to rename '\(source)' to '\(target)'. \(error.localizedDescription)", error)
251251
}
252252
}
253253
}
@@ -263,7 +263,7 @@ public class FileAccess : NSObject {
263263
try resolve(String(contentsOfFile: path.path()))
264264
}
265265
} catch {
266-
reject("ERR", "Failed to read '\(path)'.", error)
266+
reject("ERR", "Failed to read '\(path)'. \(error.localizedDescription)", error)
267267
}
268268
}
269269
}
@@ -274,7 +274,7 @@ public class FileAccess : NSObject {
274274
do {
275275
resolve(try self.statFile(path: path))
276276
} catch {
277-
reject("ERR", "Failed to stat '\(path)'.", error)
277+
reject("ERR", "Failed to stat '\(path)'. \(error.localizedDescription)", error)
278278
}
279279
}
280280
}
@@ -288,7 +288,7 @@ public class FileAccess : NSObject {
288288
.compactMap { try? self.statFile(path: base.appendingPathComponent($0).path) }
289289
)
290290
} catch {
291-
reject("ERR", "Failed to list '\(path)'.", error)
291+
reject("ERR", "Failed to list '\(path)'. \(error.localizedDescription)", error)
292292
}
293293
}
294294
}
@@ -300,7 +300,7 @@ public class FileAccess : NSObject {
300300
try FileManager.default.removeItem(atPath: path.path())
301301
resolve(nil)
302302
} catch {
303-
reject("ERR", "Failed to unlink '\(path)'.", error)
303+
reject("ERR", "Failed to unlink '\(path)'. \(error.localizedDescription)", error)
304304
}
305305
}
306306
}
@@ -314,7 +314,7 @@ public class FileAccess : NSObject {
314314
try FileManager.default.unzipItem(at: sourceUrl, to: targetUrl)
315315
resolve(nil)
316316
} catch {
317-
reject("ERR", "Failed to unzip '\(source)' to '\(target)'.", error)
317+
reject("ERR", "Failed to unzip '\(source)' to '\(target)'. \(error.localizedDescription)", error)
318318
}
319319
}
320320
}
@@ -335,7 +335,7 @@ public class FileAccess : NSObject {
335335
}
336336
resolve(nil)
337337
} catch {
338-
reject("ERR", "Failed to write to '\(path)'.", error)
338+
reject("ERR", "Failed to write to '\(path)'. \(error.localizedDescription)", error)
339339
}
340340
}
341341
}

0 commit comments

Comments
 (0)