fastlane: automatic_code_signing targets are missing

New Issue Checklist

Issue Description

I would like to run automatic_code_signing function, but targets are missing in the “Modified Targets:” list.

Let’s say I have 8 targets for my projects. When I try to update the signing details of my project’s targets 4 of them gets just updated. I tried to find what can be wrong. All the schemes are shared.

I found if I add a new target manually it will be listed in the “Modified Targets:” list. BUT! If I duplicate a target, and rename it and set it up as a different target it won’t be in that list.

What can cause this issue?

Command executed

the code I use in my lane is:

# set code sygning to automatic
automatic_code_signing(
	use_automatic_signing: false,
	code_sign_identity: 'iPhone Distribution',
)
Complete output when running fastlane, including the stack trace and command used

Environment

🚫 fastlane environment 🚫

Stack

Key Value
OS 10.14
Ruby 2.3.7
Bundler? false
Git git version 2.17.2 (Apple Git-113)
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.14 (18A391)
Ruby Lib Dir /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
OpenSSL Version LibreSSL 2.6.4
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 10.1

System Locale

Error
No Locale with UTF8 found 🚫

fastlane files:

`./fastlane/Fastfile`
###############
## run tests ##
###############
lane :run_unit_test do |lane, options|
	run_tests(
		scheme: 'pampers-rewards-ios-us',
	)
end

##########################################
## Update Project Code Signing Settings ##
##########################################
lane :update_signing_settings do |options|

	# set code sygning to automatic
	automatic_code_signing(
		use_automatic_signing: false,
		code_sign_identity: 'iPhone Distribution',
		team_id: 'ATGGD88ZP3'
	)

	# update app prov. profile
	update_project_provisioning(
		build_configuration: 'Sandbox',
		target_filter: options[:target_filter_prov],
		profile: options[:profile_path],
	)

	# update Notification Service prov. profile
	update_project_provisioning(
		build_configuration: 'Sandbox',
		target_filter: 'Notification Service',
		profile: options[:notification_profile_path],
	)

end

##############################
## PROD build to TestFlight ##
##############################
lane :release_testflight do |lane, options|
	# TBD
end

`./fastlane/Appfile`
# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple email address


# For more information about the Appfile, see:
#     https://docs.fastlane.tools/advanced/#appfile

fastlane gems

Gem Version Update-Status
fastlane 2.114.0 🚫 Update available

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.0.0
slack-notifier 2.3.2
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 1.8.0
terminal-table 1.8.0
CFPropertyList 3.0.0
multipart-post 2.0.0
word_wrap 1.0.0
public_suffix 2.0.5
tty-screen 0.6.5
babosa 1.0.2
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
unf 0.1.4
domain_name 0.5.20180417
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
gh_inspector 1.1.3
mini_magick 4.5.1
multi_json 1.13.1
multi_xml 0.6.0
rubyzip 1.2.2
security 0.1.3
xcpretty-travis-formatter 1.0.0
bundler 1.17.1
naturally 2.2.0
simctl 1.6.5
uber 0.1.0
declarative 0.0.10
declarative-option 0.1.0
representable 3.0.4
retriable 3.1.2
mime-types 3.2.2
jwt 2.1.0
signet 0.11.0
memoist 0.16.0
googleauth 0.6.7
httpclient 2.8.3
google-api-client 0.23.9
google-cloud-env 1.0.5
google-cloud-core 1.3.0
digest-crc 0.4.1
google-cloud-storage 1.16.0
tty-spinner 0.9.0
tty-cursor 0.6.1
faraday 0.15.4
json 2.2.0
io-console 0.4.5
excon 0.64.0
libxml-ruby 2.9.0
plist 3.5.0
atomos 0.1.3
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.6
xcodeproj 1.9.0
faraday_middleware 0.13.1
fastimage 2.1.5
unicode-display_width 1.6.0
addressable 2.6.0
mime-types-data 3.2019.0331
os 1.0.1
psych 2.1.0.1

generated on: 2019-05-15

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (8 by maintainers)

Most upvoted comments

Before:

				TargetAttributes = {
					5AD6E03F22C60E2800B08184 = {
						CreatedOnToolsVersion = 10.1;
						DevelopmentTeam = XXXXXXXXXX;
						ProvisioningStyle = Manual;
					};
					5AD6E06622C610AE00B08184 = {
						CreatedOnToolsVersion = 10.1;
						DevelopmentTeam = XXXXXXXXXX;
						ProvisioningStyle = Manual;
					};
				};

After:

				TargetAttributes = {
					5AD6E03F22C60E2800B08184 = {
						CreatedOnToolsVersion = 10.1;
						DevelopmentTeam = XXXXXXXXXX;
						ProvisioningStyle = Manual;
					};
					5AD6E06622C610AE00B08184 = {
						CreatedOnToolsVersion = 10.1;
						DevelopmentTeam = XXXXXXXXXX;
						ProvisioningStyle = Manual;
					};
					5AD6E0B022CB6CC200B08184 = {
						CreatedOnToolsVersion = 10.1;
						DevelopmentTeam = XXXXXXXXXX;
						ProvisioningStyle = Manual;
					};
				};

I found the issue!

While I was browsing for solution I found these:

https://github.com/Mindera/fastlane-plugin-cosigner/pull/14/files

https://www.bountysource.com/issues/45555385-disable_automatic_code_signing-problem-seems-to-be-a-very-old-project-file-format-please-use-xcode-to-upgrade-to-atlease-0800

So I checked the TargetAttributes field in pbxproj file. And the duplicated target has no data in that container, so I placed the record there and the tool worked like a charm.

			TargetAttributes = {
				5AD6E03F22C60E2800B08184 = {
					CreatedOnToolsVersion = 10.1;
					DevelopmentTeam = XXXXXXXXXX;
					ProvisioningStyle = Manual;
				};
				5AD6E06622C610AE00B08184 = {
					CreatedOnToolsVersion = 10.1;
					DevelopmentTeam = XXXXXXXXXX;
					ProvisioningStyle = Manual;
				};
				5AD6E0B022CB6CC200B08184 = {
					CreatedOnToolsVersion = 10.1;
					DevelopmentTeam = XXXXXXXXXX;
					ProvisioningStyle = Manual;
				};

So maybe this can be a spot to review in the code:

    # make sure TargetAttributes exist for all targets
    target_dictionary.each do |props|
      unless target_attributes.key?(props[:uuid])
        target_attributes[props[:uuid]] = {}
      end
    end

Also a suspicious thing: update_project_provisioning command lists all the targets!