Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codesigndoc failing to make Archive for iOS app #151

Open
ragu-pdx opened this issue Feb 1, 2022 · 14 comments
Open

Codesigndoc failing to make Archive for iOS app #151

ragu-pdx opened this issue Feb 1, 2022 · 14 comments

Comments

@ragu-pdx
Copy link

ragu-pdx commented Feb 1, 2022

I can make archives from my XCode project and this Scheme as that's what we are manually doing all the time. Not sure why this is failing, but this is an iOS app, yet it seems to be building for my Mac? Not sure what is going on there. Papaya is the name of my Mac M1 computer.

=> Creating a temporary directory for codesigndoc ...
 => Downloading version: 2.4.1
 => Downloading codesigndoc from (https://github.com/bitrise-io/codesigndoc/releases/download/2.4.1/codesigndoc-Darwin-x86_64) to (/var/folders/v9/jpwy3j4x2llcrqkwszqrpfsm0000gn/T/codesigndocXXXXXX.xhhIxbeU/codesigndoc) ...
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                         ######################################################################################################################################################################################################################################################### 100.0%-#O=- #      #          #                                                                                   ######################################################################################################################################################################################################################################################### 100.0%
 => Making it executable ...
 => codesigndoc version: 2.4.1
 => Running codesigndoc scan ...

Scan the directory for project files
You can specify the Xcode project/workscape file to scan with the --file flag.
Found one project file: LabCentral.xcworkspace.

🔦  Scanning Schemes ...
$ xcodebuild "-workspace" "/Users/ragu/Projects/ProofDx/LabCentral-iOS/LabCentral.xcworkspace" "-list"

Select the Scheme you usually use in Xcode
Please select from the list:
[1] : Alamofire
[2] : Amplify
[3] : AmplifyPlugins
[4] : Analytics
[5] : AppCenter
[6] : AWSAuthCore
[7] : AWSCognitoIdentityProvider
[8] : AWSCognitoIdentityProviderASF
[9] : AWSCore
[10] : AWSMobileClient
[11] : AWSPluginsCore
[12] : BuildNumberGenerator
[13] : CocoaLumberjack
[14] : GzipSwift
[15] : Instabug
[16] : IQKeyboardManagerSwift
[17] : KeychainSwift
[18] : Lab Central
[19] : lottie-ios
[20] : MarqueeLabel
[21] : NotificationBannerSwift
[22] : NotificationController
[23] : PB-BuildNumberGenerator
[24] : PineBluetooth
[25] : Pods-Lab Central
[26] : Realm
[27] : RealmSwift
[28] : SnapKit
[29] : SwiftCSV
[30] : SwiftLint
[31] : SwiftRichString
[32] : SwiftyAttributes
[33] : SwiftyUserDefaults
(type in the option's number, then hit Enter) [1] : 18

Xcode (xcodebuild) version: Xcode 13.2.1 (Build version 13C100)


🔦  Running an Xcode Archive, to get all the required code signing settings...
$ xcodebuild "-workspace" "/Users/ragu/Projects/ProofDx/LabCentral-iOS/LabCentral.xcworkspace" "-scheme" "Lab Central" "clean" "archive" "-archivePath" "/var/folders/v9/jpwy3j4x2llcrqkwszqrpfsm0000gn/T/__codesigndoc__727828045/Lab Central.xcarchive"
......................

Last lines of the build log:

** CLEAN SUCCEEDED **

note: Using new build system
note: Planning
Analyze workspace

Create build description
Build description signature: b284ea5e6f8f777a8fd5296cc0b6d2fb
Build description path: /Users/ragu/Library/Developer/Xcode/DerivedData/LabCentral-gkqnwlempmfvvkcvszfjrqtakywu/Build/Intermediates.noindex/ArchiveIntermediates/Lab Central/IntermediateBuildFilesPath/XCBuildData/b284ea5e6f8f777a8fd5296cc0b6d2fb-desc.xcbuild

note: Build preparation complete
note: Building targets in dependency order
error: Provisioning profile "iOS Team Provisioning Profile: com.proofdx.labcentral" doesn't include the currently selected device "Papaya" (identifier 603E4686-0F14-51F5-911D-FF37D2CC5DFD). (in target 'Lab Central' from project 'LabCentral')
** ARCHIVE FAILED **
Please check the build log to see what caused the error.

Xcode Archive failed.
Open the project: /Users/ragu/Projects/ProofDx/LabCentral-iOS/LabCentral.xcworkspace
and make sure that you can build an Archive, with the scheme: Lab Central

💡  Saving xcodebuild output into file: /Users/ragu/Projects/ProofDx/LabCentral-iOS/codesigndoc_exports/xcodebuild-output.log

------------------------------
First of all please make sure that you can Archive your app from Xcode.
codesigndoc only works if you can archive your app from Xcode.
If you can, and you get a valid .ipa/.app file if you export from Xcode,
please create an issue on GitHub at: https://github.com/bitrise-io/codesigndoc/issues
with as many details & logs as you can share!
------------------------------

Error: failed to run xcodebuild command, error: exit status 65

xcodebuild-output.log

@shams-ahmed
Copy link
Contributor

shams-ahmed commented Feb 1, 2022

@ragu-pdx I'll release version 2.4.4 tomorrow which should resolve the issue for M1

@ragu-pdx
Copy link
Author

ragu-pdx commented Feb 2, 2022

@shams-ahmed We are just following your documentation and calling bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-io/codesigndoc/master/_scripts/install_wrap-xcode.sh)"

@ragu-pdx
Copy link
Author

ragu-pdx commented Feb 2, 2022

@shams-ahmed I tried this from an Intel Mac, and got farther, but I'm hitting this endless loop at the end.

I keep selecting yes and app store build, but it's not prompting me for my bitrise credentials as your docs lead us to believe. Eventually I typed no and all that did was return me to the Terminal prompt. No ask for my bitrise credentials to upload.

Codesign settings used for archive:
development team: Proof Diagnostics, Inc. (8FRSBZPLGU)
codesign identity: Apple Development: Ragu Vijaykumar (AKPFARK9TA) [36246861944079476287028470420057172527]
provisioning profiles: iOS Team Provisioning Profile: com.proofdx.labcentral -> com.proofdx.labcentral

Targets to sign:
- com.proofdx.labcentral with 0 capabilities

Select the ipa export method
Please select from the list:
[1] : development
[2] : app-store
[3] : ad-hoc
[4] : enterprise
(type in the option's number, then hit Enter) [1] : 2


To collect available code sign files, we search for installed Provisioning Profiles:"
- which has installed Codesign Identity in your Keychain"
- which can provision your application target's bundle ids"
- which has the project defined Capabilities set"
- which matches to the selected export method"


Do you want to collect another ipa export code sign files
(select NO to finish collecting codesign files and continue) [yes/NO]: yes
Select the ipa export method
Please select from the list:
[1] : development
[2] : app-store
[3] : ad-hoc
[4] : enterprise
(type in the option's number, then hit Enter) [1] : 2


To collect available code sign files, we search for installed Provisioning Profiles:"
- which has installed Codesign Identity in your Keychain"
- which can provision your application target's bundle ids"
- which has the project defined Capabilities set"
- which matches to the selected export method"


Do you want to collect another ipa export code sign files
(select NO to finish collecting codesign files and continue) [yes/NO]: yes
Select the ipa export method
Please select from the list:
[1] : development
[2] : app-store
[3] : ad-hoc
[4] : enterprise
(type in the option's number, then hit Enter) [1] : 2


To collect available code sign files, we search for installed Provisioning Profiles:"
- which has installed Codesign Identity in your Keychain"
- which can provision your application target's bundle ids"
- which has the project defined Capabilities set"
- which matches to the selected export method"


Do you want to collect another ipa export code sign files
(select NO to finish collecting codesign files and continue) [yes/NO]: yes
Select the ipa export method
Please select from the list:
[1] : development
[2] : app-store
[3] : ad-hoc
[4] : enterprise
(type in the option's number, then hit Enter) [1] : 2


To collect available code sign files, we search for installed Provisioning Profiles:"
- which has installed Codesign Identity in your Keychain"
- which can provision your application target's bundle ids"
- which has the project defined Capabilities set"
- which matches to the selected export method"


Do you want to collect another ipa export code sign files
(select NO to finish collecting codesign files and continue) [yes/NO]:

xcodebuild-output.log

@shams-ahmed
Copy link
Contributor

shams-ahmed commented Feb 2, 2022

@ragu-pdx Please have a go now. Let me know if it fails
bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-tools/codesigndoc/master/_scripts/install_wrap.sh)"

@ragu-pdx
Copy link
Author

ragu-pdx commented Feb 2, 2022

@shams-ahmed It's getting farther on my M1 mac that is similar to my Intel Mac. However, the same issue I just posted in my last comment is still happening. I get an endless loop of asks even though I say yes as your documentation tell us to do, and at no time does it ask me to enter my Bitrise credentials.

@shams-ahmed shams-ahmed reopened this Feb 2, 2022
@shams-ahmed
Copy link
Contributor

shams-ahmed commented Feb 2, 2022

@ragu-pdx your last log seems alright.. could you try entering NO or no and seeing if you can manually move the files over?

@ragu-pdx
Copy link
Author

ragu-pdx commented Feb 2, 2022

How do I manually find the files? and move the files over to where?

@shams-ahmed
Copy link
Contributor

@ragu-pdx On the last step it will ask if you want to auto-update to Bitrise, enter No which should open a folder with the files to upload.

Also, i believe it prints out the path as well

@ragu-pdx
Copy link
Author

ragu-pdx commented Feb 2, 2022

@shams-ahmed It's not getting to that step. The logs I provided above in my second large comment are all I see after the archive build is made. It just infinite loops on asking "app store" "development" "ad-hoc", etc. if you type yes. If you type no, it just quits to command line. There is no ask for "auto-updating" to Bitrise, nor credential entering.

Just to be clear, this is what happens when i enter 'NO' at the last step, in Terminal output:

Select the ipa export method
Please select from the list:
[1] : development
[2] : app-store
[3] : ad-hoc
[4] : enterprise
(type in the option's number, then hit Enter) [1] : 2


To collect available code sign files, we search for installed Provisioning Profiles:"
- which has installed Codesign Identity in your Keychain"
- which can provision your application target's bundle ids"
- which has the project defined Capabilities set"
- which matches to the selected export method"


Do you want to collect another ipa export code sign files
(select NO to finish collecting codesign files and continue) [yes/NO]: NO
no export code sign groups collected
ragu@Papaya ~/Projects/ProofDx/LabCentral-iOS (logout) $

I don't know if this is helpful, but when we manually do this process via XCode Organizer, we always use "Automatically Manage Profiles/Certificates" rather than "Manually". Does your script reconcile with that system?

@lranches-gemini
Copy link

@ragu-pdx @shams-ahmed I'm seeing this same exact issue using an Intel Mac. Is there any fix for this?

Please select from the list:
[1] : development
[2] : app-store
[3] : ad-hoc
[4] : enterprise
(type in the option's number, then hit Enter) [1] : 3


To collect available code sign files, we search for installed Provisioning Profiles:"
- which has installed Codesign Identity in your Keychain"
- which can provision your application target's bundle ids"
- which has the project defined Capabilities set"
- which matches to the selected export method"


Do you want to collect another ipa export code sign files
(select NO to finish collecting codesign files and continue) [yes/NO]: no
no export code sign groups collected```

@lranches-gemini
Copy link

Ok so the problems seems to be that the xcode provisional profile needs to be set to the same "type". So my above example I had a development provision profile set in xcode but was trying was selecting 3 ad hoc. When I selected 1: development then everything worked.

I wish there was something in the docs explaining this that xcode needs to be set to the correct profile or something or the CLI would fail gracefully and throw a much more descriptive error.

@bmiller
Copy link

bmiller commented May 13, 2022

Was a solution to this issue ever found? I'm getting the same issue as ragu when I enter "no" for the last question it prints out "no export code sign groups collected" and exports.

Is there any chance the script has a cache at play somewhere? It worked for me the first I tried running it about a month ago. I was able to generate the files for my dev environment. This week we switched to a new Bundle ID due to a business change. So I'm trying to regenerate for the new one now.

Couple additional pieces of info, the xcodebuild log that is generated ends with "** ARCHIVE SUCCEEDED **" so I think I'm good there. I'm running it on an M1 mac mini since M1s seemed to be an issue (the run a few weeks back was on the same mac).

@bmiller
Copy link

bmiller commented May 14, 2022

It looks like I found the secret sauce for my issue. I needed to not only do an archive locally but I had to try uploading to app store connect. I went through manually uploading a build and on of of the steps it prompted me for my keychain password. I then stopped doing it manually at the final upload screen and tried the script again. This time it worked. Looks like Xcode isn't adding something that's needed to the keychain until you try to upload.

@troy379
Copy link

troy379 commented Dec 14, 2022

@bmiller many thanks!! it worked!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@bmiller @shams-ahmed @troy379 @ragu-pdx @lranches-gemini and others