iOS app crashes on startup with build configuration release and in TestFlight

Hello.

This was discovered after an Apple review of a beta build in TestFlight. We are able to reproduce this locally by going to Product > Scheme > Edit Scheme and setting Build Configuration to Release under Run.

When the app tries to start up on the simulator we get the following “state” in Xcode:

When searching for this problem, some results refer to problems with the Facebook SDK. We’ve tried following instructions and also removing the dependency all together. Same issue as above.

Our Podfile looks like this (notice we don’t use react-native-svg as it causes a number of build related issues):

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'plant-jammer' do
  pod 'ExpoKit',
    :git => "http://github.com/expo/expo.git",
    :tag => "ios/2.8.4",
    :subspecs => [
      "Core"
    ],
    :inhibit_warnings => true
  pod 'EXAdsAdMob',
    :path => "../node_modules/expo-ads-admob/ios"
  pod 'EXBarCodeScanner',
    :path => "../node_modules/expo-barcode-scanner/ios"
  pod 'EXBarCodeScannerInterface',
    :path => "../node_modules/expo-barcode-scanner-interface/ios"
  pod 'EXCamera',
    :path => "../node_modules/expo-camera/ios"
  pod 'EXCameraInterface',
    :path => "../node_modules/expo-camera-interface/ios"
  pod 'EXConstants',
    :path => "../node_modules/expo-constants/ios"
  pod 'EXConstantsInterface',
    :path => "../node_modules/expo-constants-interface/ios"
  pod 'EXContacts',
    :path => "../node_modules/expo-contacts/ios"
  pod 'EXCore',
    :path => "../node_modules/expo-core/ios"
  pod 'EXFaceDetectorInterface',
    :path => "../node_modules/expo-face-detector-interface/ios"
  pod 'EXFileSystem',
    :path => "../node_modules/expo-file-system/ios"
  pod 'EXFileSystemInterface',
    :path => "../node_modules/expo-file-system-interface/ios"
  pod 'EXFont',
    :path => "../node_modules/expo-font/ios"
  pod 'EXFontInterface',
    :path => "../node_modules/expo-font-interface/ios"
  pod 'EXGL',
    :path => "../node_modules/expo-gl/ios"
  pod 'EXGL-CPP',
    :path => "../node_modules/expo-gl-cpp/cpp"
  pod 'EXImageLoaderInterface',
    :path => "../node_modules/expo-image-loader-interface/ios"
  pod 'EXLocalAuthentication',
    :path => "../node_modules/expo-local-authentication/ios"
  pod 'EXLocation',
    :path => "../node_modules/expo-location/ios"
  pod 'EXMediaLibrary',
    :path => "../node_modules/expo-media-library/ios"
  pod 'EXPaymentsStripe',
    :path => "../node_modules/expo-payments-stripe/ios"
  pod 'EXPermissions',
    :path => "../node_modules/expo-permissions/ios"
  pod 'EXPermissionsInterface',
    :path => "../node_modules/expo-permissions-interface/ios"
  pod 'EXPrint',
    :path => "../node_modules/expo-print/ios"
  pod 'EXReactNativeAdapter',
    :path => "../node_modules/expo-react-native-adapter/ios"
  pod 'EXSegment',
    :path => "../node_modules/expo-analytics-segment/ios"
  pod 'EXSensors',
    :path => "../node_modules/expo-sensors/ios"
  pod 'EXSensorsInterface',
    :path => "../node_modules/expo-sensors-interface/ios"
  pod 'EXSMS',
    :path => "../node_modules/expo-sms/ios"

  pod 'React',
    :path => "../node_modules/react-native",
    :inhibit_warnings => true,
    :subspecs => [
      "Core",
      "ART",
      "RCTActionSheet",
      "RCTAnimation",
      "RCTCameraRoll",
      "RCTGeolocation",
      "RCTImage",
      "RCTNetwork",
      "RCTText",
      "RCTVibration",
      "RCTWebSocket",
      "DevSupport",
      "CxxBridge"
    ]
  pod 'yoga',
    :path => "../node_modules/react-native/ReactCommon/yoga",
    :inhibit_warnings => true
  pod 'DoubleConversion',
    :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
    :inhibit_warnings => true
  pod 'Folly',
    :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
    :inhibit_warnings => true
  pod 'glog',
    :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
    :inhibit_warnings => true

  pod 'RNIap', :path => '../node_modules/react-native-iap'

  pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
  
  pod 'FBSDKCoreKit', :git => 'https://github.com/facebook/facebook-objc-sdk.git', :branch => 'master'
    
  pod 'react-native-onesignal',
    :path => "../node_modules/react-native-onesignal/react-native-onesignal.podspec",
    :inhibit_warnings => true

  post_install do |installer|
    installer.pods_project.main_group.tab_width = '2';
    installer.pods_project.main_group.indent_width = '2';

    installer.pod_targets.each do |target|

    if target.pod_name == 'ExpoKit'
      target.native_target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
        
        # needed for GoogleMaps 2.x
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
      end
    end


    if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? target.pod_name
      target.native_target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end
    # Can't specify this in the React podspec because we need
    # to use those podspecs for detached projects which don't reference ExponentCPP.
    if target.pod_name.start_with?('React')
      target.native_target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
        config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
      end
    end
    # Build React Native with RCT_DEV enabled and RCT_ENABLE_INSPECTOR and
    # RCT_ENABLE_PACKAGER_CONNECTION disabled
    next unless target.pod_name == 'React'
    target.native_target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_ENABLE_INSPECTOR=0'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'ENABLE_PACKAGER_CONNECTION=0'
    end

    end
  end
end

Our package.json:

{
  "name": "myapp",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "axios-debug": "0.0.4",
    "babel-plugin-module-resolver": "^3.1.1",
    "babel-plugin-transform-inline-environment-variables": "^0.4.3",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "^3.19.0",
    "eslint-config-prettier": "^4.0.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-plugin-import": "^2.10.0",
    "eslint-plugin-node": "^4.2.2",
    "eslint-plugin-prettier": "^3.0.1",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-react": "^7.0.1",
    "eslint-plugin-react-native": "^3.2.1",
    "eslint-plugin-standard": "^3.0.1",
    "jest-expo": "30.0.0",
    "plop": "^1.9.1",
    "prettier": "^1.16.4",
    "react-native-scripts": "1.11.1",
    "react-test-renderer": "16.2.0",
    "remote-redux-devtools": "^0.5.12"
  },
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "eject": "expo eject",
    "android": "expo android",
    "ios": "expo ios",
    "test": "node node_modules/jest/bin/jest.js",
    "remotedev": "remotedev --hostname=localhost --port=19000 --injectserver=reactnative",
    "remotedev-revert": "remotedev --revert=reactnative"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "counterpart": "^0.18.5",
    "events": "^2.0.0",
    "exp": "^57.2.1",
    "expo": "^30.0.0",
    "expokit": "^1.7.1",
    "fuse.js": "^3.2.1",
    "moment": "^2.22.2",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
    "react-native-autolink": "^1.4.0",
    "react-native-card-flip": "^1.0.4",
    "react-native-country-picker-modal": "^0.6.2",
    "react-native-expo-image-cache": "^3.2.0",
    "react-native-fbsdk": "^0.8.0",
    "react-native-gifted-chat": "^0.4.3",
    "react-native-iap": "^2.3.26",
    "react-native-keyboard-aware-scrollview": "^2.0.0",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-onesignal": "^3.2.12",
    "react-native-sidebar": "^0.3.0",
    "react-native-tabs": "^1.0.9",
    "react-redux": "^6.0.0",
    "react-router-native": "^4.2.0",
    "reactotron-react-native": "^2.1.0",
    "reactotron-redux": "^2.1.0",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0",
    "sentry-expo": "~1.9.0",
    "throttle-debounce": "^1.0.1",
    "util": "^0.10.3"
  }
}

We’ve been struggling with this for a few days now. These Xcode errors are really hard to debug.

Hope someone is able to help.