From 36969fca461e3639ae799481beff6bd25f7952ff Mon Sep 17 00:00:00 2001 From: Liam McCombes Date: Wed, 26 Aug 2026 15:17:43 +0100 Subject: [PATCH] fix(ios): resolve Swift header with __has_include RNWallet.mm selected its generated Swift header path from RNWallet_USE_FRAMEWORKS, which the podspec defines whenever ENV['USE_FRAMEWORKS'] is set. That variable reports what the app requested, not how this pod is built, and podspecs are evaluated during dependency resolution -- before anything decides per-pod build types. The macro is therefore a prediction made before the answer exists. It predicts wrongly under Expo SDK 55+, whose autolinking downgrades every pod depending on React-Core to a static library in a pre_install hook. This podspec declares s.dependency "React-Core", so the pod is built as a static library while the macro still claims a framework, and compilation fails with: RNWallet.mm:5:9: fatal error: 'react_native_wallet/react_native_wallet-Swift.h' file not found __has_include is evaluated when the file compiles, after the Swift half of the target has emitted its header, so it reports what is actually on the search path. It is correct as a framework, as a static library, and under Expo's downgrade, with no environment sniffing. This matches the prevailing pattern for mixed Swift/ObjC React Native modules, including @react-native-firebase/analytics, @datadog/mobile-react-native, react-native-screens and react-native-keyboard-controller. Nothing reads the macro once the import is resolved this way, so the ENV['USE_FRAMEWORKS'] branch and the _add_compiler_flags helper that serves it are removed as dead code. --- ios/RNWallet.mm | 2 +- react-native-wallet.podspec | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/ios/RNWallet.mm b/ios/RNWallet.mm index bf424e5..f49649e 100644 --- a/ios/RNWallet.mm +++ b/ios/RNWallet.mm @@ -1,7 +1,7 @@ #import #import "RNWallet.h" -#if RNWallet_USE_FRAMEWORKS +#if __has_include() #import #else #import diff --git a/react-native-wallet.podspec b/react-native-wallet.podspec index 38e35fa..13b057b 100644 --- a/react-native-wallet.podspec +++ b/react-native-wallet.podspec @@ -2,17 +2,6 @@ require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) -$RNWallet = Object.new - -def $RNWallet._add_compiler_flags(sp, extra_flags) - exisiting_flags = sp.attributes_hash["compiler_flags"] - if exisiting_flags.present? - sp.compiler_flags = exisiting_flags + " #{extra_flags}" - else - sp.compiler_flags = extra_flags - end -end - Pod::Spec.new do |s| s.name = "react-native-wallet" s.version = package["version"] @@ -29,8 +18,4 @@ Pod::Spec.new do |s| s.dependency "React-Core" install_modules_dependencies(s); - - if ENV['USE_FRAMEWORKS'] - $RNWallet._add_compiler_flags(s, "-DRNWallet_USE_FRAMEWORKS=1") - end end