iOS Archive does not respect release flag
I've spent hours debugging a problem with an IPA and ends ups that the CLI does not respect the --release flag when it does archiving. I have the following in my build.xconfig:
DEVELOPMENT_TEAM = 9832T735TV;
CODE_SIGN_ENTITLEMENTS = <My App>/Resources/app.entitlements;
CODE_SIGN_IDENTITY[config=Debug] = iPhone Developer;
CODE_SIGN_IDENTITY[config=Release] = iPhone Distribution;
PROVISIONING_PROFILE[config=Debug] = a5ec2d86-9bfb-48e4-b8c0-a75c39a0a5bd;
PROVISIONING_PROFILE[config=Release] = a03834fd-afb5-4bda-a789-c6bda4550ec0;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
When I run tns build ios --for-device --release and I inspect the contents of the platforms/ios/build/device/<myapp>.app the embedded.mobileprovision is the correct one (the Release one above). But if I extract the IPA file's Payload and inspect the embeeded.mobileprovision there it is the wrong one (the Debug one above). If I go to platforms/ios/archive and open the archive in XCode and export for AdHoc (for example) the correct provisioning profile is being used.
Expected behavior
The CLI should use the same provision profile when archiving as the one used to build the .app file.
Edit: @PeterStaev Confirmed this is what is causing a lot of headache right now, it's trying to select my development certificate when archiving. How do we work around this until a patch is released?
Am not sure if this is related to 3.x, XCode, or something else -- it's happening for someone on ionic too: https://forum.ionicframework.com/t/ionic-prod-release-build-incorrectly-adding-development-provision-profile/98940
Was a workaround ever found?