react-native-schemes-manager: After upgrading to react-native 0.60.x schemes other than production (default) do not work.

Steps to reproduce the behavior

  1. Upgrade to react-native 0.60.x
  2. Adapt code & configuration of packages to conform with auto-linking, etc.
  3. Run the ios version of the app using a configured scheme

Expected behavior

The app should install and run with the defines scheme

Actual behavior

When using cli (i.e. react-native run-ios --scheme \"TheSampleApp-Development\" --configuration Debug.Development) the command compiles successfully, the app is installed but opens with a blank black screen (after showing the splash screen) on the simulator.

On the other hand when using xcode to build the development scheme, the app again installs and runs, reaches the splash screen and after that we get a white blank screen. In xcode the output is the following:

2019-07-22 21:02:18.412065+0300 TheSampleApp[22447:687268] Attempted to override non-null API key with nil - ignoring.
WARN : BSG_KSCrashSentry.c (109): BSG_KSCrashType bsg_kscrashsentry_installWithContext(BSG_KSCrash_SentryContext *, BSG_KSCrashType, void (*)(char, char *)): KSCrash: App is running in a debugger. Only user reported events will be handled.
2019-07-22 21:02:18.451 [fatal][tid:main] No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
2019-07-22 21:02:18.451125+0300 TheSampleApp[22447:687268] No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
2019-07-22 21:02:18.467287+0300 TheSampleApp[22447:687268] *** Terminating app due to uncaught exception 'RCTFatalException: No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.', reason: 'No bundle URL present.

Make sure you're running a packager server or have included a .jsbundle file in your application bundle.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001072d96fb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x00000001053aaac5 objc_exception_throw + 48
	2   TheSampleApp             0x0000000101f860dc RCTGetFatalHandler + 0
	3   TheSampleApp             0x0000000101f9e39e __28-[RCTCxxBridge handleError:]_block_invoke + 685
	4   libdispatch.dylib                   0x0000000109835d7f _dispatch_call_block_and_release + 12
	5   libdispatch.dylib                   0x0000000109836db5 _dispatch_client_callout + 8
	6   libdispatch.dylib                   0x0000000109844080 _dispatch_main_queue_callback_4CF + 1540
	7   CoreFoundation                      0x00000001072408a9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	8   CoreFoundation                      0x000000010723af56 __CFRunLoopRun + 2310
	9   CoreFoundation                      0x000000010723a302 CFRunLoopRunSpecific + 626
	10  GraphicsServices                    0x000000010d52a2fe GSEventRunModal + 65
	11  UIKitCore                           0x0000000110edaba2 UIApplicationMain + 140
	12  TheSampleApp             0x0000000101e752a0 main + 112
	13  libdyld.dylib                       0x00000001098ab541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

The bundler is already running separately in both occasions via yarn start as for some reason it stopped running automatically after/during building the app.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 12
  • Comments: 28 (6 by maintainers)

Most upvoted comments

@TylerNRobertson

Per the convo here, if you’re on or upgrade to 0.60.5 and you make the changes in your ios/Podfile described above, this library is likely not necessary anymore (can’t really speak to non-cocoapods dependencies at this point, all of our deps right now have a podspec). So if you upgrade, you should uninstall react-native-schemes-manager which is where that error is coming from.

The update you need to make in ios/Podfile depends on what build configurations you created.

Based off the docs here, you generally need to add something like the following near the top of the file, right after require_relative.

project 'TheNameOfYourProjectWithoutTheXprojExtension',
    'Debug' => :debug,
    'Release' => :release,
    'FooDebug' => :debug,
    'FooRelease' => :release

Where:

  • Debug and Release are the built-in build configurations
  • FooDebug is a build configuration you cloned from Debug
  • FooRelease is a build configuration you cloned from Release

And then you need to run cd ios/Pods && pod install && cd ../ to update your project.

What you’re essentially doing is converting your json build configuration map you had in your package.json for xcodeSchemes into ruby code in your Podfile to tell cocoapods about the build configurations now that RN core uses cocoapods.

Today react-native 0.60.5 dropped but it doesn’t seem to include that PR for fixing custom release scheme. I had to manually make the changes in that PR to my project.

When I made the change @doomsower recommended, I was able to build and run release builds and debug builds with custom schemes and build configurations without installing this library at all.

The specific change to ios/Podfile I made was just adding that project call right after require_relative at the top level. Then I just ran rm -rf Pods && pod install (EDIT: in the ios/ directory)

project 'MyProject',
    'DevDebug' => :debug,
    'StagingDebug' => :debug,
    'Debug' => :debug,
    'DevRelease' => :release,
    'StagingRelease' => :release,
    'Release' => :release

(where MyProject is the name of your XCode project without the extension).

EDIT: You’ll also need to change the hash/map there. The keys (i.e. DevDebug, etc.) should be the name of the build configurations you clones from Debug/Release and the values are the type of configuration they are. See my comment farther down here.

So as far as the react-native core 0.60+ goes, this library isn’t needed it seems. For third-party deps though that don’t use cocoapods it probably will be? I’m not familiar enough to say for sure.

I tried installing this library to see what would happen and it fails on react-native 0.60.5 and I’m not 100% sure why.

Steps:

  1. On a base RN 0.60.5 install, create custom build configuration(s), create custom scheme(s), and assign the configurations to the schemes appropriately
    • I created the following schemes: MyAppDev, MyAppStaging
    • I created the following Debug duplicate build configurations: DevDebug, StagingDebug
    • I created the following Release duplicate build configurations: DevRelease, StagingRelease
  2. Run yarn add --dev react-native-schemes-manager
  3. Add scheme mapping to package.json under the xcodeSchemes key
    • I added the following:
      "xcodeSchemes": {
        "Debug": [
          "DevDebug",
          "StagingDebug"
        ],
        "Release": [
          "DevRelease",
          "StagingRelease"
        ],
        "projectDirectory": "ios"
      }
      
  4. Run yarn run react-native-schemes-manager fix-libraries

(I only ran fix-libraries since fix-script doesn’t seem to be necessary anymore)

That command fails on this line of fix-scripts.js:

https://github.com/thekevinbrown/react-native-schemes-manager/blob/bd96830b99d971df1574cfdc1be9bf9e294a1bbf/src/fix-libraries.js#L47

With this error:

yarn run v1.16.0
$ PROJECT_PATH_OMITTED/node_modules/.bin/react-native-schemes-manager fix-libraries
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/ART/ART.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/ART/ART.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/ART/ART.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/ART/ART.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/Image/RCTImage.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/Image/RCTImage.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/Image/RCTImage.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/Image/RCTImage.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/Sample/Sample.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/Sample/Sample.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/Sample/Sample.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/Sample/Sample.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/Text/RCTText.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/Text/RCTText.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/Text/RCTText.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/Text/RCTText.xcodeproj
 ✔ [fix-libraries]: Debug -> DevDebug created in node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj
 ✔ [fix-libraries]: Debug -> StagingDebug created in node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj
 ✔ [fix-libraries]: Release -> DevRelease created in node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj
 ✔ [fix-libraries]: Release -> StagingRelease created in node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj
PROJECT_PATH_OMITTED/node_modules/react-native-schemes-manager/src/fix-libraries.js:47
					if (!configList) throw new Error(`Unable to find config list for build configuration: ${sourceConfig.name}`);
					                 ^

Error: Unable to find config list for build configuration: Debug
    at updateProject (PROJECT_PATH_OMITTED/node_modules/react-native-schemes-manager/src/fix-libraries.js:47:29)
    at utilities.updateProjectsMatchingGlob PROJECT_PATH_OMITTED/node_modules/react-native-schemes-manager/src/fix-libraries.js:86:10)
    at getFilesMatchingGlob (PROJECT_PATH_OMITTED/node_modules/react-native-schemes-manager/src/utilities.js:70:8)
    at glob (PROJECT_PATH_OMITTED/node_modules/react-native-schemes-manager/src/utilities.js:45:5)
    at f (PROJECT_PATH_OMITTED/node_modules/once/once.js:25:25)
    at Glob.<anonymous> (PROJECT_PATH_OMITTED/node_modules/glob/glob.js:151:7)
    at Glob.emit (events.js:189:13)
    at Glob._finish (PROJECT_PATH_OMITTED/node_modules/glob/glob.js:197:8)
    at done (PROJECT_PATH_OMITTED/node_modules/glob/glob.js:182:14)
    at Glob._processGlobStar2 (PROJECT_PATH_OMITTED/node_modules/glob/glob.js:637:12)
error Command failed with exit code 1.

The specific change to ios/Podfile I made was just adding that project call right after require_relative at the top level. Then I just ran rm -rf Pods && pod install (EDIT: in the ios/ directory)

project 'MyProject',
    'DevDebug' => :debug,
    'StagingDebug' => :debug,
    'Debug' => :debug,
    'DevRelease' => :release,
    'StagingRelease' => :release,
    'Release' => :release

(where MyProject is the name of your XCode project without the extension).

EDIT: You’ll also need to change the hash/map there. The keys (i.e. DevDebug, etc.) should be the name of the build configurations you clones from Debug/Release and the values are the type of configuration they are. See my comment farther down here.

This worked for me. Thanks!!!

I have set up my project with schemes manager the same way as I did as before RN 0.60.5, but with these changes to get it working:

diff --git a/node_modules/react-native-schemes-manager/src/fix-libraries.js b/node_modules/react-native-schemes-manager/src/fix-libraries.js
index d587997..a2a878a 100644
--- a/node_modules/react-native-schemes-manager/src/fix-libraries.js
+++ b/node_modules/react-native-schemes-manager/src/fix-libraries.js
@@ -44,7 +44,10 @@ function updateProject (project) {
 					const sourceConfig = sourceConfigs[key];
 					const configList = configListForConfig(configLists, key);

-					if (!configList) throw new Error(`Unable to find config list for build configuration: ${sourceConfig.name}`);
+					if (!configList) {
+						console.log(`Unable to find config list for build configuration: ${sourceConfig.name}`);
+						continue;
+					}

 					// Copy that bad boy.
 					const clone = JSON.parse(JSON.stringify(sourceConfig));

And the podfile addition mentioned by @bericp1 :

project 'TheNameOfYourProjectWithoutTheXprojExtension',
    'Debug' => :debug,
    'Release' => :release,
    'FooDebug' => :debug,
    'FooRelease' => :release

This way it satisfies both the pods and the non-pods dependencies

@salvariable

Yep to get it to work with 0.60.5, all I had to do was:

  1. Create my build configurations and schemes in XCode
  2. Not install this library
  3. Manually apply the changes in this diff
  4. Add a project call with my scheme/configuration mappings to the top-level of my ios/Podfile.
  5. Run cd ios && pod install && cd ../

@hans0low

Not that I remember. Did you apply the changes from this diff? Not sure what else would cause that error.

I managed to fix debug config too. RN0.60 uses cocoapods to build the project, and in cocoapods you have to explicitly specify if your custom build configuration is based on debug configuration. So I had to add the following line to my repro project linked in previous post:

project 'schemes60', 'DebugCopy' => :debug

and then reinstall pods. And it worked.

@bericp1 thanks for the response. Had everything correct except for not including this project anymore.

Works great now!

I’ve tried to debug this. here is the minimal reproduction repo. I initialized a project from scratch with 0.59, added react-native-schemes-manager and checked that custom debug scheme works. Then I tried the same steps with 0.60, one commit per step.

Custom debug scheme doesn’t work. Tracked it down to this line. For some reason, RCT_DEV macro is not defined. I can see that RCTDefines.h sets it based on DEBUG, and I can see that DEBUG is true in preprocessor macros settings in XCode. But my understanding of objC is not good enough to go deeper.

Custom release scheme doesn’t work too. However I managed to make it work by deleting tests. This PR should fix it.