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
- Upgrade to react-native 0.60.x
- Adapt code & configuration of packages to conform with auto-linking, etc.
- 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)
@TylerNRobertson –
Per the convo here, if you’re on or upgrade to
0.60.5and you make the changes in yourios/Podfiledescribed 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 uninstallreact-native-schemes-managerwhich is where that error is coming from.The update you need to make in
ios/Podfiledepends 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.Where:
DebugandReleaseare the built-in build configurationsFooDebugis a build configuration you cloned fromDebugFooReleaseis a build configuration you cloned fromReleaseAnd 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.jsonforxcodeSchemesinto ruby code in yourPodfileto tell cocoapods about the build configurations now that RN core uses cocoapods.Today
react-native0.60.5dropped 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/PodfileI made was just adding thatprojectcall right afterrequire_relativeat the top level. Then I just ranrm -rf Pods && pod install(EDIT: in theios/directory)(where
MyProjectis 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 fromDebug/Releaseand 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-native0.60.5and I’m not 100% sure why.Steps:
MyAppDev,MyAppStagingDevDebug,StagingDebugDevRelease,StagingReleaseyarn add --dev react-native-schemes-managerpackage.jsonunder thexcodeSchemeskeyyarn run react-native-schemes-manager fix-libraries(I only ran
fix-librariessincefix-scriptdoesn’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:
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:
And the podfile addition mentioned by @bericp1 :
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:projectcall with my scheme/configuration mappings to the top-level of myios/Podfile.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:
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-managerand 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_DEVmacro is not defined. I can see thatRCTDefines.hsets it based onDEBUG, and I can see thatDEBUGis 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.