Xcode project scheme is not currently configured for the test action - ios

I am trying to run an Xcode unit test for my iOS application. I am willing to do it on an iPad connected via USB to a Mac. I am trying to run the test from the command line in order to trigger it from Jenkins later on.
Below is what I'm currently typing into the command line and the error I'm getting. Please help.
The code:
xcodebuild test -scheme MyApplication -destination "platform=iOS,name=iPad"
The error:
Scheme MyApplication is not currently configured for the test action

For me the problem was that no tests were added to my scheme:
By adding test bundles to my scheme via the '+' button then the scheme could be built by Xcode and xcodebuild.

For everyone struggling with this problem.
My solution was to:
Select Test Target
Manage Scheme
Select Run in the left menu
Select Info in the tab
Choose Executable Target from the dropdown menu
Hit Close.

Fixed this up by removing duplicate schemes from Xcode. The schemes can be added/removed/shared/edited in Xcode via Product -> Scheme -> Manage Schemes.

Please follow following steps to resolve this error.
Select your project scheme at the top.
Click on Manage Schemes.
Select your test target in the popup.
Make sure to click on Edit button at the bottom left of popup.
Select Build.
Click the checkbox below "Run"
Close the popup.

You should check your workspace data on Jenkins and see which *.xctest is already uploaded. Then you have to rename your UI/Unit test target to that *.xctest data in your xcode project like what you
have on Jenkins and then push again.
OR wipe out your workspace from Jenkins and push all data again with new UI/Unit test target again.
(Of course you have to ensure that you have already made a scheme for project.)

In my case I had no test file...
Here is a tutorial to perform UI Tests and create screenshots :
https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line

My problem was that the Tests.swift file was importing a module that no longer existed (I renamed the Targets for the project). Check to make sure all test files are importing currently existing modules.

I was getting this similar error, but none of the other solutions helped. Since the error was first noticed while running via Fastlane, I next ran xcodebuild manually using this command to mimic the same.
xcodebuild -workspace Noname.xcworkspace -scheme Noname -enableCodeCoverage YES build-for-testing
I then saw errors regarding: Signing for "Noname-Dependency" requires a development team.
I also so reference to a macosx signing error, which I cannot sadly reproduce having since fixed the issue.
To fix the issue, under Signing & Capabilities for the Target I selected None and then under General I unchecked Mac, as we are not needing/using that but it was selected by default when creating this new project (CocoaPod).
Oddly enough, I added back Mac and things still kept working. I think that there is a oddity with the Xcode project file and/or scheme file(s) such that when you tinker enough with it -- things get reset/fixed.

I had a test plan set up (xctestplan).
I needed a separate configuration for the tests (the test plan) in addition to "Shared Settings".
Please also make sure that the test plan (under Xcode scheme settings) includes a test target AND a configuration.
Screenshots attached:

In my case, it was failing intermittently with this error, turns out I had two schemes with the same name and Xcode sometimes picked the wrong one, so make sure you do xcodebuild -workspace "MyWorkspace.xcworkspace" -list to see all your schemes and find out if you have repeating names.

Your test plan should have at least one custom configuration.

Go to Manage Schemes.
Delete all schemes and click on Autocreate Schemes.

Related

$(PRODUCT_BUNDLE_IDENTIFIER) is not a valid bundle identifier

I'm porting a Chrome extension to Safari. I can test the extension locally, it works. I can also build it locally, I get no errors.
When I try to upload it to App Store Connect, I get the following errors:
This doesn't make much sense to me. I do have valid Bundle identifiers set in my Targets > General > Identity:
But somehow my bundle identifiers do not seem to get applied when an archive is built. I am very new to XCode. Any tips on how to debug and/or fix this would be greatly appreciated.
Your bundle identifier has a hyphen in it. That's what's illegal about it.
Click on project at the top of the source file tree in the left sidebar, select the target in a mini sidebar on the left, and switch to Build Settings. In build settings select the following filter: All, Combined.
Then type in the following in the search bar on the right hand side: PRODUCT_BUNDLE_IDENTIFIER and verify that both Release and Debug configurations have sane values set. Then do the same for PRODUCT_NAME.
The problem was not solved by the above suggested questions. It turns out that I had to port the Chrome extension again, using the most recent XCode. (The original porting happened using an earlier version of XCode).

An empty identity is not valid when signing a binary for the product type 'Application' in xcode version 10.2

I have compile webrtc ios source code ,then I used the command:
gn gen out/ios --args='target_os="ios" target_cpu="arm64"' --ide=xcode
then I open the workspace with Xcode.
but when I compile the code, Xcode gives me this error below.
An empty identity is not valid when signing a binary for the product type 'Application'. (in target 'AppRTCMobile')
my Xcode version is 10.2, the latest version.
I really don't know how did this happen,can anyone can help me?
my code sign setting is:
everything looks ok.
I added CODE_SIGNING_ALLOWED=NO as an additional parameter and that fixed this issue for me.
I needed to to turn OFF Automatic manage signing and turn it ON afterwards. It seems like Xcode did fix some inconsistency by that action.
I saw this error in Xcode 12.2b when building to run on a device, but I had not set signing to Automatic, or selected profiles, etc.
Basically I was running and testing on the simulator, then plugged in a device for testing and forgot to change any signing settings.
Perhaps this error is new to Xcode 12.x for that scenario.
If you're using CocoaPods check your project.pbxproj for (null) references, there's an issue that make BuildFile references to become (null)
Even if you have the identity correctly defined it may be "empty" because of this issue
Try, as suggested:
pod deintegrate
pod install
This error can occur when an Xcode project is generated (rather than built from within xcode), and the generated output project is unexpectedly in release mode.
I was working on a Godot project and got the above error which led me to this post. The error is not WebRTC or Godot specific.
If you only want to debug the project for now on a device, and don't need release builds yet, switch to a debug scheme using the scheme switcher (1)
If the generator didn't create a debug scheme, (which is the case for me for my issue) you can add one via New Scheme (2)
At first I could not work out why it was complaining about "empty identity" (this refers to the Team drop down) when as per the screen shot I had this value set. I had the project view filter settings on Debug (as per the screenshot (3) so the Release settings (where Team was set to "None") were not showing up. Change this to All to see if that is where the None in the error is coming from for you.
Debug builds only require a basic signing setup. If you still have issues with Release builds when it comes time for that, you may need to clear out certificates & provisioning profiles from your Derived Data, Apple Developer portal and Keychain.
Release build certificates are hard to manage & replace so be careful with randomly generating & deleting them.
The problem has been fixed, it's my mistake.
Select the target, then choose info.plist and select the one for your project.

Xcode Scheme with multiple targets creates Generic Xcode Archive

Ok, I am almost certain that this thing worked before but I am stuck now...
I have a workspace with multiple targets which I want to archive and submit to appstore simultaneously.
I have created a new scheme, I have all targets selected in there for Archive and I try to execute Archive in order to make all targets to IPAs
I always end up getting an Xcode Generic Archive. The only case I am getting an IPA is to select Skip Install = YES for all targets but one each time, which I suppose it actually means to build just one target so there is no meaning to multi target scheme.
Any clues about that? I checked the size of this Generic Archive and it looks like all apps combined in one file.
Indeed Apple confirmed that this is "impossible because archiving step in a scheme is designed to produce only one archive" and they asked me to build every target separately. I wonder if I can archive every scheme in a workspace automatically from command line to produce the desired result.
In order to create an IPA file using Xcode, we can use commands too. One can follow these steps:
1. Navigate to the App folder in Terminal
2. Run Cordova build command using "cordova build iOS" command
3. Open your iOS Project in Xcode.
4. Choose Product -> Clean. Then Archive.
More detailed screenshots are available here.

Xcode 5 iOS app not using correct product name for build id

I am having some issues with the build id for my App.
I have two builds set up, Debug and Release. I've already created two schemes App-debug and App-release.
App-debug is set to use the Debug configuration and app-release the Release config. In my build settings I've set the Product Name field to appStaging and appPublish for the Debug and Release build configurations respectively.
However, the build identifier field gets set to appPublish even when I've selected the app-debug scheme. I am not sure why, but it is affecting my ability to archive the product correctly. What am I missing?
It seems that if I run a product clean, close xcode and reopen it, the bundle identifier shows up correctly in the target info. However, when I run a Product -> Archive something happens and it builds for appPublish and after, the build identifier displays the wrong name. Still no idea why this is happening though.
OK I figured out the reason -- each scheme has a separate section for the Archive settings that is separate from the Run settings. I missed this earlier, which is why I kept running into this issue.

Xcode can build a project but can't run it on simulator

When I download a project from the web, sometimes it can be built but doesn't run (XCode -> Product -> Run is disabled, in grey). This never happens when I create projects myself. What could be the problem? Is it somehow connected with version?
I'm new to iOS development and download projects from the web for studying purposes. It's a pity not to be able to test them on the simulator.
Generally, if you can't Run a project, either:
It doesn't have a build scheme that knows how to "run". Check at the top next to the Run/Stop buttons that there's a profile name and target device shown. If the box says No Scheme then click on it and create a New Scheme. If there IS a scheme, click on the drop-down menu (left divider in Xcode 4.2+, anywhere on the box otherwise) and go to Edit Scheme to make sure the scheme was set up correctly for Running
It doesn't have a build configuration set. You should see this in the Run section of your build scheme. Check there's one selected. If the list is empty, go to the Project icon at the top of the leftmost pane, select the Project, go into the Info section, and create a build configuration, although there should already be at least one if you can build the project
It doesn't have a runnable target at all, which might mean you've got a project which compiles to a static library or framework for use in OTHER projects. If this is the case, you should see the icon for your build Target as a yellow toolbox (framework), or a little white building (a "library", although to me it looks more like the United States Supreme Court Building).
The target isn't valid for the Simulator, which means you might need to add i386 to the list of Architectures and Valid Architectures on the Target before you can run it
The target isn't valid for the currently connected device. For this one, check the Deployment Target number is set back enough to be valid for the device's version of iOS
Xcode can't see the connected device. Try unplugging and plugging it back in. If it still doesn't recognize it, you may have not added it to Xcode (Window -> Devices -> Select the device -> Use for Development)
Make sure that in your Edit Scheme (click on your project name next to stop button -> Edit Scheme), in the Info tab of the Run menu selection, that your .app is selected as the Executable. I had this issue and "None" was selected, happened after refactoring the project's name and reconfiguring the build targets.
you may download a project that the deployment setting (the ios version) is higher than the one your xcode support. if this is your situation, you has two options to sovle the problem.
try run the project in a older deployment option. follow these instructions (
if the project just setting to a higher version but not using any feature of the higher version. this approach should work):
select project file in xcode > select the target you are going to run > select summary tab > in section 'iOS Application Target' > in the combo box about 'Deployment Target' select the version that your Xcode support.
and then you could select and run the project in the simulator.
if the project dose use features in the higher version, then you should update your Xcode in order to run the project.
Hope this helps!
In my case the issue was really simple, I needed to check "Launch: Automatically" check in "Product > Scheme > Edit scheme > Run" menu.
When this setting wasn't checked I cannot find App icon in simulator to launch application.
In My Case Sole by Go->Project->Architectures->Architecture=select standard architectures(armv7,arm64)...
same as
Go->Target->Architectures->Architecture=select standard architectures(armv7,arm64)...

Resources