Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project are documented in this file.

## Unreleased

### Fixed

- **iOS startup crash on React Native 0.80+ (`folly dynamic.cpp:378 Check failed: 0`).**
`NitroPay.podspec` no longer defines `FOLLY_NO_CONFIG` on React Native ≥ 0.80
(mismatched folly config vs React Native core). Flags remain for React Native < 0.80.

## 0.0.16 — 2026-07-07

### Breaking changes
Expand Down
13 changes: 13 additions & 0 deletions docs/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ npx expo prebuild --clean

## iOS (Apple Pay)

### App crashes at launch with `folly dynamic.cpp:378 Check failed: 0`

On React Native 0.80+ (e.g. Expo SDK 57), the app can abort at startup with a stack
ending in `folly::dynamic::get<bool>()` / `BaseViewProps`. Linking the library is
enough; no pay button needs to be on screen.

Cause: `NitroPay.podspec` defined `FOLLY_NO_CONFIG`, mismatching React Native core's
folly config. **Fixed after 0.0.16** — upgrade, then rebuild:

```bash
npx expo prebuild --clean
```

### Apple Pay button not showing

- **Merchant ID mismatch:** The Expo plugin `merchantIdentifier` must exactly match your Apple Developer Merchant ID.
Expand Down
38 changes: 34 additions & 4 deletions package/NitroPay.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "json"
require "open3"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Expand All @@ -22,10 +23,39 @@ Pod::Spec.new do |s|
"cpp/**/*.{hpp,cpp}",
]

s.pod_target_xcconfig = {
# C++ compiler flags, mainly for folly.
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES"
}
# FOLLY_NO_CONFIG conflicts with RN >= 0.80's generated folly-config.h.
# Fail hard if React Native cannot be resolved — a silent fallback would apply
# the wrong Folly flags and either crash modern RN or break older installs.
pod_root = Pod::Config.instance.installation_root.to_s
rn_package_path, _stderr, status = Open3.capture3(
"node",
"--print",
"require.resolve('react-native/package.json')",
chdir: pod_root
)
rn_package_path = rn_package_path.strip
unless status.success? && !rn_package_path.empty? && File.exist?(rn_package_path)
raise "NitroPay: unable to resolve react-native/package.json from #{pod_root}. " \
"Install React Native before running `pod install`."
end

rn_version = JSON.parse(File.read(rn_package_path))["version"]
if rn_version.nil? || rn_version.to_s.strip.empty?
raise "NitroPay: react-native package.json is missing a version field (#{rn_package_path})."
end

begin
react_native_below_80 = Gem::Version.new(rn_version) < Gem::Version.new("0.80.0")
rescue ArgumentError
raise "NitroPay: unable to parse React Native version #{rn_version.inspect} from #{rn_package_path}."
end

if react_native_below_80
s.pod_target_xcconfig = {
# C++ compiler flags, mainly for folly.
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES"
}
end

load 'nitrogen/generated/ios/NitroPay+autolinking.rb'
add_nitrogen_files(s)
Expand Down
Loading