From 40b26e062663098b65a4573840879140795c0203 Mon Sep 17 00:00:00 2001 From: Alpha Date: Thu, 25 Jan 2024 18:41:07 -0500 Subject: [PATCH] fix(ios): error reporting details --- .../project.pbxproj | 15 ++++++++++++ example/package.json | 4 ++-- ios/FileAccess.swift | 24 +++++++++---------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/example/ios/FileAccessExample.xcodeproj/project.pbxproj b/example/ios/FileAccessExample.xcodeproj/project.pbxproj index dab69a8..474fabb 100644 --- a/example/ios/FileAccessExample.xcodeproj/project.pbxproj +++ b/example/ios/FileAccessExample.xcodeproj/project.pbxproj @@ -580,6 +580,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", + _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION, ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -606,6 +607,11 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-Wl", + "-ld_classic", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; @@ -647,6 +653,10 @@ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION, + ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -670,6 +680,11 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); + OTHER_LDFLAGS = ( + "$(inherited)", + "-Wl", + "-ld_classic", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/example/package.json b/example/package.json index feef870..fc6aba4 100644 --- a/example/package.json +++ b/example/package.json @@ -11,13 +11,13 @@ }, "dependencies": { "react": "18.2.0", - "react-native": "0.71.8" + "react-native": "0.71.15" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "babel-plugin-module-resolver": "^4.1.0", - "metro-react-native-babel-preset": "0.73.9" + "metro-react-native-babel-preset": "0.73.10" } } diff --git a/ios/FileAccess.swift b/ios/FileAccess.swift index e6ec35c..51edb34 100644 --- a/ios/FileAccess.swift +++ b/ios/FileAccess.swift @@ -77,7 +77,7 @@ public class FileAccess : NSObject { try FileManager.default.copyItem(atPath: source.path(), toPath: target.path()) resolve(nil) } catch { - reject("ERR", "Failed to copy '\(source)' to '\(target)'.", error) + reject("ERR", "Failed to copy '\(source)' to '\(target)'. \(error.localizedDescription)", error) } } } @@ -94,7 +94,7 @@ public class FileAccess : NSObject { try FileManager.default.copyItem(atPath: assetPath, toPath: target.path()) resolve(nil) } catch { - reject("ERR", "Failed to copy '\(asset)' to '\(target)'.", error) + reject("ERR", "Failed to copy '\(asset)' to '\(target)'. \(error.localizedDescription)", error) } } } @@ -136,7 +136,7 @@ public class FileAccess : NSObject { "internal_total": stat[.systemSize] ]) } catch { - reject("ERR", "Failed to stat filesystem.", error) + reject("ERR", "Failed to stat filesystem. \(error.localizedDescription)", error) } } } @@ -222,7 +222,7 @@ public class FileAccess : NSObject { do { try resolve(FileManager.default.contentsOfDirectory(atPath: path.path())) } catch { - reject("ERR", "Failed to list '\(path)'.", error) + reject("ERR", "Failed to list '\(path)'. \(error.localizedDescription)", error) } } } @@ -234,7 +234,7 @@ public class FileAccess : NSObject { try FileManager.default.createDirectory(atPath: path.path(), withIntermediateDirectories: true, attributes: nil) resolve(path) } catch { - reject("ERR", "Failed to create directory '\(path)'.", error) + reject("ERR", "Failed to create directory '\(path)'. \(error.localizedDescription)", error) } } } @@ -247,7 +247,7 @@ public class FileAccess : NSObject { try FileManager.default.moveItem(atPath: source.path(), toPath: target.path()) resolve(nil) } catch { - reject("ERR", "Failed to rename '\(source)' to '\(target)'.", error) + reject("ERR", "Failed to rename '\(source)' to '\(target)'. \(error.localizedDescription)", error) } } } @@ -263,7 +263,7 @@ public class FileAccess : NSObject { try resolve(String(contentsOfFile: path.path())) } } catch { - reject("ERR", "Failed to read '\(path)'.", error) + reject("ERR", "Failed to read '\(path)'. \(error.localizedDescription)", error) } } } @@ -274,7 +274,7 @@ public class FileAccess : NSObject { do { resolve(try self.statFile(path: path)) } catch { - reject("ERR", "Failed to stat '\(path)'.", error) + reject("ERR", "Failed to stat '\(path)'. \(error.localizedDescription)", error) } } } @@ -288,7 +288,7 @@ public class FileAccess : NSObject { .compactMap { try? self.statFile(path: base.appendingPathComponent($0).path) } ) } catch { - reject("ERR", "Failed to list '\(path)'.", error) + reject("ERR", "Failed to list '\(path)'. \(error.localizedDescription)", error) } } } @@ -300,7 +300,7 @@ public class FileAccess : NSObject { try FileManager.default.removeItem(atPath: path.path()) resolve(nil) } catch { - reject("ERR", "Failed to unlink '\(path)'.", error) + reject("ERR", "Failed to unlink '\(path)'. \(error.localizedDescription)", error) } } } @@ -314,7 +314,7 @@ public class FileAccess : NSObject { try FileManager.default.unzipItem(at: sourceUrl, to: targetUrl) resolve(nil) } catch { - reject("ERR", "Failed to unzip '\(source)' to '\(target)'.", error) + reject("ERR", "Failed to unzip '\(source)' to '\(target)'. \(error.localizedDescription)", error) } } } @@ -335,7 +335,7 @@ public class FileAccess : NSObject { } resolve(nil) } catch { - reject("ERR", "Failed to write to '\(path)'.", error) + reject("ERR", "Failed to write to '\(path)'. \(error.localizedDescription)", error) } } }