Skip to content

Commit

Permalink
fix(ios): error reporting details
Browse files Browse the repository at this point in the history
  • Loading branch information
alpha0010 committed Jan 25, 2024
1 parent 7179426 commit 40b26e0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
15 changes: 15 additions & 0 deletions example/ios/FileAccessExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
};
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
24 changes: 12 additions & 12 deletions ios/FileAccess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand Down Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand Down

0 comments on commit 40b26e0

Please sign in to comment.