bitrise-steplib / steps-ios-auto-provision-appstoreconnect

MIT License
15 stars 16 forks source link

Failed to apply code sign settings for target •••••: failed to get project’s target attributes #11

Closed shpuntov closed 3 years ago

shpuntov commented 4 years ago

Hi there. ios-auto-provision-appstoreconnect step failed with the following logs:

| (4) ios-auto-provision-appstoreconnect@0                                     |
+------------------------------------------------------------------------------+
| id: ios-auto-provision-appstoreconnect                                       |
| version: 0.1.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2020-07-03T10:22:06Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
Config:
- BuildAPIToken: [REDACTED]
- BuildURL: https://app.bitrise.io/build/[redacted]
- ProjectPath: [redacted].xcworkspace
- Scheme: [redacted]-Dev
- Configuration: 
- Distribution: app-store
- MinProfileDaysValid: 0
- CertificateURLList: [REDACTED]
- CertificatePassphraseList: 
- KeychainPath: /Users/vagrant/Library/Keychains/login.keychain
- KeychainPassword: *****
- VerboseLog: false
Creating AppstoreConnectAPI client
the client created for https://api.appstoreconnect.apple.com/
Analyzing project
configuration: Release
project team ID: [redacted]
bundle IDs:
- com.[redacted].ios.dev
platform: iOS
Downloading certificates
1 certificates downloaded:
- Apple Distribution: [redacted], Inc. ([redacted])
ensuring codesigning files for distribution types: [app-store]
Checking app-store provisioning profiles for 1 bundle id(s)
  Checking bundle id: com.[redacted].ios.dev
  capabilities: map[aps-environment:development]
  Bitrise managed profile found: Bitrise iOS app-store - (com.[redacted].ios.dev)
  the profile is not in sync with the project requirements, regenerating ...
  Searching for app ID for bundle ID: com.[redacted].ios.dev
  app ID found: [redacted] iOS App DEV
  app ID capabilities are in sync with the project capabilities
  Creating profile for bundle id: [redacted] iOS App DEV
  profile created: Bitrise iOS app-store - (com.[redacted].ios.dev)
Apply Bitrise managed codesigning on the project
  Target: [redacted]-Dev
  development Team: [redacted], Inc.([redacted])
  provisioning Profile: Bitrise iOS app-store - (com.[redacted].ios.dev)
  certificate: Apple Distribution: [redacted], Inc. ([redacted])
Failed to apply code sign settings for target ([redacted]-Dev): failed to get project's target attributes, error: key: string("TargetAttributes") not found in: serialized.Object(serialized.Object{"LastSwiftUpdateCheck":"1110", "LastUpgradeCheck":"1140", "ORGANIZATIONNAME":"[redacted], Inc."})
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | ios-auto-provision-appstoreconnect@0 (exit code: 1)           | 25.98 sec|
+---+---------------------------------------------------------------+----------+
| Issue tracker: ...se-steplib/steps-ios-auto-provision-appstoreconnect/issues |
| Source: ...thub.com/bitrise-steplib/steps-ios-auto-provision-appstoreconnect |
+---+---------------------------------------------------------------+----------+

When I add the following node into my .pbproj file (at path objects / E3E19E12236C4564004FC698 /* Project object */ / attributes), the step works without the issue.

TargetAttributes = {
  E3E19E43236C75B5004FC698 = {
  };
  E3E19E51236C75BE004FC698 = {
  };
  E3E19E5F236C75C7004FC698 = {
  };
};

But each time I change something in the project, Xcode automatically removes this node, and the step get failed again.

This is happen with v2 version of my app, corresponding Xcode project has been created in October 2019, and obviously it uses a bit more modern .pbproj format, which doesn’t include TargetAttributes node. The old v1 project (which has been created in 2015) does contain this node, and Xcode keeps it on project changes saving (and even keeps some info inside a certain target node, like SystemCapabilities and so on). From my point it looks like the step relies on a project structure which a bit outdated at the moment. Interesting, that once the step is able to find TargetAttributes and target identifier node inside, it thinks that everything is ok, so even empty E3E19E43236C75B5004FC698 subnode works.

Could you please update your step regarding this aspect, or let me know what I could do on my side. Obviously, I do want to use new ios-auto-provision-appstoreconnect step rather than the old one ios-auto-provision. Thanks.

karagraysen commented 4 years ago

Hi @shpuntov,

Can you please share a build log and enable support access?

shpuntov commented 4 years ago

Hi @non-binary,

I've enabled support access for the app https://app.bitrise.io/app/b338271a50f1ffd0 And here's the build log: 69aae9b99fd24c0e.log

karagraysen commented 4 years ago

@shpuntov I see you have a green build. Are you still experiencing this?

shpuntov commented 4 years ago

@non-binary yes, problem is still there. My build is green because I have had to hack my .pbproj to make it works. It's very dirty hack, and it's unstable: every change of my Xcode project removes this hack, and I have to add it again, otherwise build gets failed. I described this in details in the head post of this issue. And I even made an assumption why this could happen. 😄

shpuntov commented 4 years ago

@non-binary I have to add this block in my Xcode project file:

TargetAttributes = {
  E3E19E43236C75B5004FC698 = {
  };
  E3E19E51236C75BE004FC698 = {
  };
  E3E19E5F236C75C7004FC698 = {
  };
};

The step is failed if I don't do this. At the same time Xcode don't want to have this block in project file, and removes it each time I make changes in my project (e.g. add a file). Only you guys can help here and fix your step behaviour.

karagraysen commented 4 years ago

@shpuntov Ah, I see. Thanks for clarifying. I will share this with our tooling team.

jeyremy commented 4 years ago

Hi, i'm experiencing the same issue. did you find a workaround ?

shpuntov commented 4 years ago

Hi, i'm experiencing the same issue. did you find a workaround ?

I did. See my post above, it's mostly about workaround.

alvarocofre commented 4 years ago

I have the same issue

LRNZ09 commented 3 years ago

I'm experiencing the same issue in a React Native project

shpuntov commented 3 years ago

@non-binary any updates on this?

karagraysen commented 3 years ago

Unfortunately no update yet.

vapor-pawelw commented 3 years ago

Having the same issue, switched over because it was promoted to do so already so I hoped it would be stable release, but it's not working at all for me now

godrei commented 3 years ago

Hi @shpuntov , could you please let me know how can I generate a project withouth TargetAttributes?

It seems some other tools handle TargetAttributes as required too:

godrei commented 3 years ago

I managed to reproduce it, for example if you duplicate a target, Xcode will not generate TargetAttributes for it.

shpuntov commented 3 years ago

@godrei I'm experiencing this issue with the project I've created on November 2019, with the most recent Xcode version at that moment, so I wouldn't say that this project is too old (as they say here).

I've just tried to switch project format from 9.3 to the most recent 12.0, and here is what I've got: project format So even on the most recent project format it still tries to remove this TargetAttributes node.

I've tried to create a new project, but it does contain TargetAttributes node. So I can't say exactly why my project removes this node on every change. I have no ideas, sorry about that.

godrei commented 3 years ago

Hi @shpuntov thanks for the detailed issue report!

We released a new version of the step (0.1.2), which solves this issue.

If you still experience the same problem, please open a new issue.