iosreact-nativeazure-devopsazure-pipelinesappcenter

XCode@5 overrides bundle identifier for all targets in the scheme


I am trying to build an iOS app in Azure DevOps as App Center will be stopped on the 31th March 2025.

I have a single react native application for both Android and iOS. The application is built according to different environments (develop, test, production) but also different application id (for instance com.my-app-1.app and com.my-app-2.app).

To build the Android app, I had no problem in Azure DevOps and the sign steps will use the provided keystore and the push to Firebase or Play Store will push the app to the correct place according to the application id.

Problem for the iOS build, I am using different certificate (iOS Development for develop and iOS Distribution for test and production) but also the certificates are different per teams (I have a team-A for the application com.my-app-1.app and a team-b for the application com.my-app-2.app) so two different Apple Developer as well.

The my-app.xcodeproj define the default team and the default application id which are team-A and com.my-app-1.app respectively.

I found here that normally I could update my XCode@5 step like this:

- task: Xcode@5
        inputs:
          actions: "archive"
          scheme: "my-app-1"
          sdk: "iphoneos"
          configuration: "Release"
          xcWorkspacePath: "iOS/ios/my-app-1.xcworkspace"
          signingOption: "manual"
          signingIdentity: "$(APPLE_CERTIFICATE_SIGNING_IDENTITY)"
          provisioningProfileUuid: "$(DevelopmentProfile.provisioningProfileUuid)"
          args: >
            DEVELOPMENT_TEAM=team-A
            PRODUCT_BUNDLE_IDENTIFIER=com.my-app-1.app

To build the my-app-1 of team-A

And like this

- task: Xcode@5
        inputs:
          actions: "archive"
          scheme: "my-app-2"
          sdk: "iphoneos"
          configuration: "Release"
          xcWorkspacePath: "iOS/ios/my-app-1.xcworkspace"
          signingOption: "manual"
          signingIdentity: "$(APPLE_CERTIFICATE_SIGNING_IDENTITY)"
          provisioningProfileUuid: "$(DevelopmentProfile.provisioningProfileUuid)"
          args: >
            DEVELOPMENT_TEAM=team-B
            PRODUCT_BUNDLE_IDENTIFIER=com.my-app-2.app

But if I do that I got this error for both build:

error: XXX does not support provisioning profiles. XXX does not support provisioning profiles, but provisioning profile prov profile name has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'XXX')

Making the signing as Automatic doesn't help as I need to specify the certificate and provisioning profile file.

If I don't override the value of DEVELOPMENT_TEAM and PRODUCT_BUNDLE_IDENTIFIER then it builds fine for the default application but not for the team-B application as I got this error:

/Users/runner/work/1/s/ios/BITS.xcodeproj: error: Provisioning profile "XXX" has app ID "com.my-app-2.com", which does not match the bundle ID "com.my-app-1.com". (in target 'my-app-1' from project 'MY-APP-1')
/Users/runner/work/1/s/ios/BITS.xcodeproj: error: Provisioning profile "XXX" belongs to team "team-B", which does not match the selected team "team-B". (in target 'my-app-1' from project 'MY-APP-1')

Anyone an idea how to fix it?

In App Center I didn't had that issue as it built and change the main app target properly. Now in DevOps I run into this error.

I would rather not to build a separate XCode project for each application Id.

Migrate the iOS build from App Center to Azure DevOps for multi teams and multi application id.


Solution

  • Please try the workaround mentioned in this case with similar issue.

    Add the following code to your podfile:

    post_install do |installer|
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
                config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
                config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
            end
        end
    end
    

    You can refer the sample full podfile in this answer.