expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
29.49k stars 4.68k forks source link

Automatic Signing Forced on iOS #28363

Open dawidvdh opened 3 weeks ago

dawidvdh commented 3 weeks ago

Summary

When setting the code sign style to manual and providing provisioning profiles in Xcode it will always be reset to automatic signing when running expo.

I have reviewed the docs and even gone as far as building a config plugin to force the xcode project to be set to manual signing with certain provisioning profiles:

import {ConfigPlugin, IOSConfig, withXcodeProject} from '@expo/config-plugins'

const withManualSigning: ConfigPlugin = config => {
  return withXcodeProject(config, async config => {
    const project = config.modResults
    const targets = IOSConfig.Target.findSignableTargets(project)

    targets.forEach(([nativeTargetId, nativeTarget]) => {
      IOSConfig.XcodeUtils.getBuildConfigurationsForListId(
        project,
        nativeTarget.buildConfigurationList
      ).forEach(config => {
        const [, item] = config
        item.buildSettings.CODE_SIGN_STYLE = 'Manual'
        item.buildSettings.DEVELOPMENT_TEAM = '""'
        item.buildSettings.PROVISIONING_PROFILE_SPECIFIER =
          '"match Development com.app.sample"'
      })

      Object.entries(IOSConfig.XcodeUtils.getProjectSection(project))
        .filter(IOSConfig.XcodeUtils.isNotComment)
        .forEach(([, item]) => {
          if (!item.attributes.TargetAttributes[nativeTargetId]) {
            item.attributes.TargetAttributes[nativeTargetId] = {}
          }
          item.attributes.TargetAttributes[nativeTargetId].ProvisioningStyle =
            'Manual'
          item.attributes.TargetAttributes[nativeTargetId].DevelopmentTeam =
            '""'
        })
    })

    return config
  })
}

export default withManualSigning

However without fail whenever I run expo run ios it will always set the signing back to Automatic, which I believe is a symptom of the setAutoCodeSigningInfoForPbxproj method that appears to be called whenever all the targets have a team.

Can this be overridden in anyway? we have recently started migrating to expo and this is a bit of a blocker for us to continue with our migration and I would love to know if there is something I am missing to avoid this.

What platform(s) does this occur on?

iOS

SDK Version

50.0.17

Environment

expo-env-info 1.2.0 environment info: System: OS: macOS 14.3 Shell: 5.9 - /bin/zsh Binaries: Node: 20.8.0 - ~/.cache/fnm_multishells/98231_1713774848055/bin/node Yarn: 3.6.3 - ~/.cache/fnm_multishells/98231_1713774848055/bin/yarn npm: 10.1.0 - ~/.cache/fnm_multishells/98231_1713774848055/bin/npm Watchman: 2024.03.25.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/dawid/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4 IDEs: Android Studio: 2023.1 AI-231.9392.1.2311.11330709 Xcode: 15.3/15E204a - /usr/bin/xcodebuild npmPackages: expo: ~50.0.17 => 50.0.17 react: 18.2.0 => 18.2.0 react-native: 0.73.6 => 0.73.6 Expo Workflow: bare

Minimal reproducible example

I am happy to supply a minimal reproducible example if thats required but I think the problem is relatively evident in the code and the previous explanation.

dawidvdh commented 3 weeks ago

The Answer here was seemingly setting the team id, even though the CLI will report Auto signing app using team(s): XXXXX it will actually still be set to manual, it would be great if this could just be configured through the app config.