Reputation: 1963
Currently i'm developing a react-native application for iOS which uses firebase as the backend. To separate the 3 environments dev, staging, and prod i created 3 different schemas in xCode with 3 different run configurations.
appNameDev => uses the debug run configuration
appNameStaging => uses the staging run configuration
appNameProd => uses the release run configuration
In the build phase i use this configuration to pick the right GoogleService-Info.plist
case "${CONFIGURATION}" in
"Debug" )
echo "BUILD CONFIG: DEBUG"
cp -r "$PATH_TO_GOOGLE_PLISTS/Debug/GoogleService-Info.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" ;;
"Staging" )
echo "BUILD CONFIG: STAGING"
cp -r "$PATH_TO_GOOGLE_PLISTS/Staging/GoogleService-Info.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" ;;
"Release" )
echo "BUILD CONFIG: RELEASE"
cp -r "$PATH_TO_GOOGLE_PLISTS/Release/GoogleService-Info.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" ;;
*)
;;
esac
When i run the different builds from xCode everything works as expected
When it try to run the build with different schemas from the command-line with the react-native cli
npx react-native run-ios --scheme appName[stage]
it always runs the app with the Debug configuration, which is shown by the xcode terminal output
"xcodebuild -workspace appNameApp.xcworkspace -configuration Debug -scheme appNameStaging -destination id=simId"
When i tried to add the configuration in the command
npx react-native run-ios --scheme appName[stage] --configuration Release
the build is successful, but the app is instantly crashing on start with the following error log
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: DYLD 1 Library missing Library not loaded: @rpath/OpenSSL.framework/OpenSSL Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/C7DABD19-235F-439E-95B6-3EA2607F037D/data/Containers/Bundle/Application/8463C40A-A7D3-4482-9BED-EC8938BB8483/appName.app/appName Reason: tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/Users/username/Library/Developer/CoreSimulator/Devices/C7DABD19-235F-439E-95B6-3EA2607F037D/data/Containers/Bundle/Application/8463C40A-A7D3-4482-9BED-EC8938BB8483/appName.app/F (terminated at launch; ignore backtrace)
Upvotes: 4
Views: 3228
Reputation: 629
You can fix this error by adding OpenSSL to Target's Frameworks & Libraries. Follow these steps in Xcode:
Upvotes: 0