codesigndoc icon indicating copy to clipboard operation
codesigndoc copied to clipboard

codesigndoc does not find scheme with UITests enabled

Open ehyche opened this issue 5 years ago • 14 comments

In our iOS app, I attempted to use codesigndoc to export the code-signing files for running UI tests. The Terminal.app output is included below. There IS a scheme present that has UITests enabled:

Screen Shot 2020-09-28 at 11 08 21 AM Screen Shot 2020-09-28 at 11 09 47 AM

But codesigndoc does not identify the CoachUITests scheme.

I WAS able to run a build-for-test run in Xcode successfully.

So here is the run of codesigndoc:

ehyche in ~/src/github/noom/coach-ios (develop) > bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-tools/codesigndoc/master/_scripts/install_wrap-xcode-uitests.sh)"
 => 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/lr/bztrcn1x42l5q8fwwyh2422c0000gp/T/codesigndocXXXXXX.qViPbywf/codesigndoc) ...
################################################################################################################# 100.0%################################################################################################################# 100.0%
 => Making it executable ...
 => codesigndoc version: 2.4.1
 => Running codesigndoc scan ...


Xcode (xcodebuild) version: Xcode 11.7 (Build version 11E801a)

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

🔦  Scanning Schemes ...
Error: no schemes found with UITest target enabled:

------------------------------
First of all, check the selected scheme in Xcode:
- Make sure, you have enabled at least one UITest target for test run in the selected scheme's build option.
- Make sure that the UITest target is added (and enabled) in the selected scheme's test option.

After this please make sure that you can run build-for-testing for your app from Xcode.
codesigndoc only works if you can run build-for-testing for your app from Xcode.
For this run a clean in your Xcode, after that, run a build-for-testing for your app in Xcode.
If you can, and you get a valid *-Runner.app file, please create an issue on GitHub at: https://github.com/bitrise-io/codesigndoc/issues
with as many details & logs as you can share!
------------------------------

So then I did the following:

  1. Opened Xcode and selected the CoachUITests scheme shown above
  2. Did a Clean
  3. Deleted my Derived Data folder
  4. Ran Product/Build For Testing. That completed successfully.
  5. Then I looked in the Derived Data folder, and was able to find the -Runner.app.
ehyche in ~/src/github/noom/coach-ios (develop) > cd ~/Library/Developer 
ehyche in ~/Library/Developer  > find . -name "*-Runner.app"
./Xcode/DerivedData/Noom-durciaqeajcieegapeqmlkivmlux/Build/Products/Staging-iphoneos/CoachUITests-Runner.app
./CoreSimulator/Devices/26C6FAB9-CDC3-4E85-BEC0-3A5A41C9E68B/data/Containers/Bundle/Application/79124390-9362-483D-82E2-1C122BD56890/CoachUITests-Runner.app

So as you can see, the CoachUITests-Runner.app was created successfully.

ehyche avatar Sep 28 '20 16:09 ehyche

Hi @ehyche I am sorry to hear that you are having issues with the code signing. Can you please make sure that the scheme is shared? And if you are using cocoapods, the scheme needs to be shared with the workspace, not just the project.

Thanks Chaitanya

chaitanyatanna-bitrise avatar Sep 28 '20 16:09 chaitanyatanna-bitrise

Yes, it is shared. If you look in the top screenshot, just to the right of the "Manage Schemes" button, you will see that the "Shared" button is checked.

In regards to your question "the scheme needs to be shared with the workspace, not just the project.": How do I tell/change if the scheme is shared with the workspace and/or project (other than the "Shared" checkbox above)?

ehyche avatar Sep 28 '20 18:09 ehyche

@chaitanyatanna-bitrise : I checked where the CoachUITests.xcscheme file was located. Previously, it was located here:

./Coach_iOS/Coach.xcodeproj/xcshareddata/xcschemes

So I did the following:

  1. Went to "Manage Schemes..."
  2. Found the "CoachUITests" scheme
  3. Changed the Container from "Coach project" to "Noom Workspace"
  4. Made sure the "Shared" checkbox was still checked.

Now the CoachUITests.xcscheme file is now located here:

./Noom.xcworkspace/xcshareddata/xcschemes/CoachUITests.xcscheme

That is, inside the workspace's xcshareddata folder.

But still, the codesigndoc run fails to find it:

ehyche in ~/src/github/noom/coach-ios (ehyche/AT2-1011-move-CoachUITests-scheme) > bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-tools/codesigndoc/master/_scripts/install_wrap-xcode-uitests.sh)"
 => 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/lr/bztrcn1x42l5q8fwwyh2422c0000gp/T/codesigndocXXXXXX.JbShw97z/codesigndoc) ...
################################################################################################################# 100.0%################################################################################################################# 100.0%
 => Making it executable ...
 => codesigndoc version: 2.4.1
 => Running codesigndoc scan ...


Xcode (xcodebuild) version: Xcode 11.7 (Build version 11E801a)

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

🔦  Scanning Schemes ...
Error: no schemes found with UITest target enabled:

------------------------------
First of all, check the selected scheme in Xcode:
- Make sure, you have enabled at least one UITest target for test run in the selected scheme's build option.
- Make sure that the UITest target is added (and enabled) in the selected scheme's test option.

After this please make sure that you can run build-for-testing for your app from Xcode.
codesigndoc only works if you can run build-for-testing for your app from Xcode.
For this run a clean in your Xcode, after that, run a build-for-testing for your app in Xcode.
If you can, and you get a valid *-Runner.app file, please create an issue on GitHub at: https://github.com/bitrise-io/codesigndoc/issues
with as many details & logs as you can share!
------------------------------

I verified that after the change to move the CoachUITests.xcscheme file to the workspace's xcshareddata folder, that I can still successfully run the build-and-test.

ehyche avatar Sep 28 '20 20:09 ehyche

Here is the screenshot of the "Manage Schemes..." dialog:

Screen Shot 2020-09-28 at 3 53 26 PM

ehyche avatar Sep 28 '20 20:09 ehyche

Hi @ehyche You would also need to check that the changes are reflected in the xcschemes file and that file is correctly committed to the repository. https://stackoverflow.com/questions/14368938/xcodebuild-says-does-not-contain-scheme

chaitanyatanna-bitrise avatar Sep 29 '20 18:09 chaitanyatanna-bitrise

@chaitanyatanna-bitrise : I have verified that the CoachUITests.xcscheme file is correctly committed to the repository in Noom.xcworkspace/xcshareddata/xcschemes.

When you say "the changes are reflected in the xcschemes file", what changes are you referring to?

ehyche avatar Sep 29 '20 20:09 ehyche

Hey @ehyche!

I'd be happy to dig into this further for you. I need the following:

1.) Please enable support access for your account.

2.) Please send me the link to a recently failed build.

3.) I need your written permission to create a debug workflow on your account and connect to your build via remote access. Note that this will allow me to view your source code.

Thanks,

Matthew Senior Customer Engineer

mjones-droid avatar Oct 05 '20 13:10 mjones-droid

@ehyche Did you manage to solve this issue, I'm experiencing the same. I've tried everything and I keep getting Error: no schemes found with UITest target enabled:

tobitech avatar Oct 26 '20 07:10 tobitech

Is this issue solved? Any clue? I'm having the same problem (and I'm not using workspace as I'm not using Cocoapods).

cassio-rossi avatar Jan 15 '21 15:01 cassio-rossi

As @mjones-droid requested, can you provide a build link and enable support access so we can take a look and investigate further?

istx25 avatar Jan 19 '21 14:01 istx25

I don't understand why you need access to our account if the problem is related to a script being executed locally on our machines to generate the certificates to allow Xcode to build the project. So, if we can't generate the certificates, there is no failed build to look at. The problem is on the script bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-tools/codesigndoc/master/_scripts/install_wrap-xcode-uitests.sh)" The script bash -l -c "$(curl -sfL https://raw.githubusercontent.com/bitrise-tools/codesigndoc/master/_scripts/install_wrap.sh)" is working fine. The workaround I did was to rename the bundle Id of my UI Test target and generate the certificates.

cassio-rossi avatar Jan 19 '21 17:01 cassio-rossi

Hi everyone! Sorry for the confusion earlier. In case anyone who is experiencing this issue is able to send us a project file at [email protected] that would be really helpful in debugging this case.

bitce avatar Feb 01 '21 10:02 bitce

Having the same problem...was this ever resolved

tijojose27 avatar May 11 '21 02:05 tijojose27

Hey there @tijojose27 , could you please submit a ticket to us on support.bitrise.io/hc or write us an email to [email protected]? Please send us the log file or the URL of the related build and also enable Support Access on the Settings tab of the app ( https://devcenter.bitrise.io/troubleshooting/enabling-bitrise-support-user/ ) so that we can take a more in-depth look. 🙂

Roland-Bak avatar Jun 01 '21 10:06 Roland-Bak