1

I am trying to setup Jenkins with fastlane. I got two targets in my project - main app and watch kit extension. When I try to change profile for Ad Hoc signing with xcargs, gym change profile for all targets and my builds fail.

This is my gym command.

gym(scheme: "MyApp", 
      workspace: "MyApp.xcworkspace",
      xcargs: "PROVISIONING_PROFILE_SPECIFIER='MyApp Ad Hoc'")

This is output.

Building MyApp/MyApp WatchKit App [Release]
[08:34:48]: ▸ Check Dependencies
[08:34:48]: ▸ ❌  Provisioning profile "MyApp Ad Hoc" doesn't match the entitlements file's value for the application-identifier entitlement.

How to change profile only for a specific target? Thank you.

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
Eugene Trapeznikov
  • 3,220
  • 6
  • 47
  • 74

2 Answers2

3

You should use the provisioningProfiles option as follows:

gym(
  ...
  export_options:{
    signingStyle: "manual",
    provisioningProfiles:{
        "com.myapp.iosapp": "match AdHoc com.myapp.iosapp"
    }
Francois Nadeau
  • 7,023
  • 2
  • 49
  • 58
0

You do not need export_options at all, if you correctly define sigh for every target.

cert()
sigh(
  adhoc: options[:adhoc],
  app_identifier: options[:bundle_id],
  provisioning_name: options[:provisioning],
  ignore_profiles_with_different_name: true,
)
sigh(
  adhoc: options[:adhoc],
  app_identifier: options[:share_bundle_id],
  provisioning_name: options[:share_provisioning],
  ignore_profiles_with_different_name: true,
)
build_ios_app(
  workspace: PLZ_WORKSPACE,
  scheme: options[:scheme],
  clean: true,
  export_method: options[:adhoc] ? "ad-hoc" : "app-store",
  export_xcargs: "-allowProvisioningUpdates",
  output_directory: OUTPUT_PATH,
)

Remember that this way you need to manually install your provisioning profiles on CI machine or wherever you gonna run this out.

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358