thekevinbrown/react-native-schemes-manager

Does this work for different targets?

evanjmg opened this issue · 5 comments

Steps to reproduce the behavior

Seems like when I duplicate a target (different app store for a whitelabel) it still wants to go debug even though its a release on the archive.

Expected behavior

It should be release on archive - my architectures are correct in the build settings

Actual behavior

Debug instead of release

Seems I misunderstood the package.json - the mapping works fine as long as you have xcodeSchemes: { [Scheme]: [Config, Config] }

I was mistaken - seems it's only Debug / Release? Can someone explain this to me? I copied my target which was working and now the new copied target keeps doing the above

Happy to explain. This package does a few things (and only those things):

  • It replaces the shell script that actually kicks off the react native packager so that it can correctly tell the packager whether it's a debug or release build. The stock version says the only debug configuration is called "Debug". This might be the cause of what you're seeing.
  • It runs a script which goes through your node_modules folder and fixes up .xcodeproj files to add your schemes to them. This is important for them to realise they're in debug mode. (This is unlikely to cause what you're seeing, but could still cause it I suppose. It doesn't remove anything, it only adds.)
  • It hides your library schemes as they clutter up the menu. (I suspect this has nothing to do with what you're seeing.)

You can isolate the various things the package is doing to narrow down the cause by removing the all script from your postinstall, removing your node_modules, then npm i and run each command one at a time until you see the behaviour.

Does that help at all?

The code that goes through the build steps is here:
https://github.com/thekevinbrown/react-native-schemes-manager/blob/master/src/fix-script.js

So yes, the script swapper should go through every build step of project.hash.project.objects.PBXShellScriptBuildPhase and check if there's the string react-native-xcode.sh in it. If you've got multiple targets and it's not doing this for all targets, you'd just need to figure out where the other targets are in the project once it's parsed.

Can you trace through and figure out exactly what this library is doing or isn't doing for you that you want it to do or provide a reproduction case so I can have a look?