Closed rachid-debu closed 3 years ago
Thanks, @rachid-debu! Can you provide some context on the setup you do? Is the .xcworkspace file committed to the repository?
hi @bitce, thanks for answering.
.xcworkspace
is generated with
ionic build ios --buildFlag="-UseModernBuildSystem=0"
and is not commited.
Here's the relevant part of my workflow bitrise.yml file :
- script@1:
title: INIT & build IOS
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# init & build ios
npm run init
npm run init:ios
npm run build-ios:$BIT_NODE_ENV_SHORT
- ios-auto-provision-appstoreconnect@0:
inputs:
- project_path: "$BITRISE_SOURCE_DIR/platforms/ios/Doyouno.xcodeproj"
- scheme: Doyouno
- build_url: "$BITRISE_SOURCE_DIR/platforms/ios/build/emulator/Doyouno.app"
- configuration: release
- verbose_log: 'yes'
- distribution_type: app-store
- xcode-archive@2:
inputs:
- team_id: XXX-CENSORED-XXX
- project_path: "$BITRISE_SOURCE_DIR/platforms/ios/Doyouno.xcworkspace"
- scheme: Doyouno
- compile_bitcode: 'no'
- upload_bitcode: 'no'
- export_method: app-store
Those commands in my script step don't do anything crazy npm install, webpack, ionic build
:
# init & build ios
npm run init
npm run init:ios
npm run build-ios:$BIT_NODE_ENV_SHORT
Here's my xcscheme file :
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "xxxxxxx-censored-xxxxxx"
BuildableName = "Doyouno.app"
BlueprintName = "Doyouno"
ReferencedContainer = "container:Doyouno.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "xxxxxxx-censored-xxxxxx"
BuildableName = "Doyouno.app"
BlueprintName = "Doyouno"
ReferencedContainer = "container:Doyouno.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "xxxxxxx-censored-xxxxxx"
BuildableName = "Doyouno.app"
BlueprintName = "Doyouno"
ReferencedContainer = "container:Doyouno.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "xxxxxxx-censored-xxxxxx"
BuildableName = "Doyouno.app"
BlueprintName = "Doyouno"
ReferencedContainer = "container:Doyouno.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Here's a screenshot of file structure inside xcworkspace :
Maybe it is related to the Build URL of the step.
URL of the current build or local path URL to your appledeveloperportal_data.json
What does that mean ?
I tried using the BITRISE_BUILD_URL
, tried using : $BITRISE_SOURCE_DIR/platforms/ios/Doyouno.app
I think this build url is expecting a previous variable created with bitrise Ionic build.
@bitce For info, I've downgraded to the prevision version of steps-ios-auto-provision-appstoreconnect
--> steps-ios-auto-provision
and provided the obsolete authentication method. My build is working fine now.
Regarding this new version, I didn't manage to get this working. I'll stick to the older one, until further notice.
I'm experiencing the same issue with a Cordova generated project. The file structure:
+ file='/Users/vagrant/git/platforms/ios/MTinfo 3000 TST.xcworkspace'
+ ls -R -ltr '/Users/vagrant/git/platforms/ios/MTinfo 3000 TST.xcworkspace'
total 8
drwxr-xr-x 3 vagrant staff 96 Jun 25 14:19 xcshareddata
-rw-r--r-- 1 vagrant staff 233 Jun 25 14:21 contents.xcworkspacedata
/Users/vagrant/git/platforms/ios/MTinfo 3000 TST.xcworkspace/xcshareddata:
total 0
drwxr-xr-x 3 vagrant staff 96 Jun 25 14:19 xcschemes
/Users/vagrant/git/platforms/ios/MTinfo 3000 TST.xcworkspace/xcshareddata/xcschemes:
total 8
-rw-r--r-- 1 vagrant staff 3399 Jun 25 14:19 MTinfo 3000 TST.xcscheme
This step's output:
Config:
- BuildAPIToken: [REDACTED]
- BuildURL: https://app.bitrise.io/build/b5ce7f49e9e3eb70
- ProjectPath: /Users/vagrant/git/platforms/ios/MTinfo 3000 TST.xcworkspace
- Scheme: MTinfo 3000 TST
- 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
Failed to analyze project: failed to find the main target of the scheme (MTinfo 3000 TST): failed to find scheme (MTinfo 3000 TST) in project: scheme MTinfo 3000 TST not found in MTinfo 3000 TST
hi @mac89 sorry for late answer. but I've managed to solve my issue by using the older version of this bitrise step :
https://github.com/bitrise-steplib/steps-ios-auto-provision
it is the basic step iOS Auto Provision
(without app store connect API).
for this one to work, you will have to provide your apple credentials in your bitrise settings page.
let me know if this worked for you.
@bitce this new version of the step seem to have some issues, maybe needs to be investigated.
hi @mac89 sorry for late answer. but I've managed to solve my issue by using the older version of this bitrise step : https://github.com/bitrise-steplib/steps-ios-auto-provision it is the basic step
iOS Auto Provision
(without app store connect API). for this one to work, you will have to provide your apple credentials in your bitrise settings page.let me know if this worked for you.
@bitce this new version of the step seem to have some issues, maybe needs to be investigated.
I resorted to this as well. I perused through the source code, but could not find the cause.
This issue was closed without resolution to the step itself (the appconnect one). Can this be reopened until a proper solution exists?
I've recently spent a day or so debugging this Bitrise step and this was one of my issues. The problem as far as I could see it is that this step doesn't load the workspace; it loads the project. Other tools produced by Bitrise check if the path is a workspace or project and open the correct one, but this step doesn't. As all of our schemes are defined within the workspace and not within each project it fails to find the defined scheme.
I got this step running locally using the Bitrise CLI and was playing around with it. Indeed changing the logic to open the workspace via (xcworkspace.Open(pth)
) rather than the project (xcodeproj.Open(pth)
) results in the scheme being visible. You can see that despite the path being described as either a project or workspace (projOrWSPath
), the code only ever opens the project. This project is then used when looking up the target, which will fail.
The workaround for us was to copy-paste the relevant scheme from Foobar.xcworkspace/xcshareddata/xcschemes
to Foobar.xcodeproj/xcshareddata/xcschemes
. This step will then find the scheme and everything works as expected. I did think about submitting a PR but my Go isn't fantastic unfortunately and wasn't sure if this behaviour was intentional.
@bitce is it worth reopening this?
@ceeK We experienced the same issue. We needed to switch to ios-auto-provision-appstoreconnect
because of Apple's changes to authentication in February 2021 so the "solution" above (reverting to the old username-password version of the build step) was not possible.
I'd like to say thanks for the information you posted in the comment above as it allowed us to find a work-around which unblocked our build process. Hopefully @bitce and/or the Bitrise team can fix this in the build step as it seems broken from our perspective (at least for any non-Capacitor Ionic projects).
For other developers who are currently blocked on this, we fixed it by adding another "Script" build step before "iOS Auto Provision with App Store Connect API":
In this script we simply copy all the schemes from .xcworkspace
into .xcodeproj
.
echo "Copying Workspace schemes to Project..."
mkdir -p platforms/ios/YOUR_SCHEME.xcodeproj/xcshareddata/xcschemes
cp -Rv platforms/ios/YOUR_SCHEME.xcworkspace/xcshareddata/xcschemes/* platforms/ios/YOUR_SCHEME.xcodeproj/xcshareddata/xcschemes/
echo "Done."
Hey all, thanks for everyone that contributed to the resolution of this issue. I believe someone at Bitrise should take a look and apply the fix that @ceeK already spent some hours investigating and debugging - that behavior doesn't seem to be "intentional" AFAICT :) I'd normally open a PR to fix this issue but since there's a decently clean workaround… 😁
@coreymcmahon thanks for the very handy script! 💯
@rachid-debu could you reopen this issue? 🙏
Hello
I'm build a cordova based iOS app. I'm using the
Scripts
step to do the build (because we have some commands to be ran). Build succeeds.My problem is afterwards, with
ios-auto-provision-appstoreconnect
i'm getting the error below :Failed to analyze project: failed to find the main target of the scheme (Doyouno): failed to find scheme (Doyouno) in project: scheme Doyouno not found in Doyouno
Here's a link to my build : https://app.bitrise.io/build/1717dca025d9baad#?tab=log
Would highly appreciate some help.
Let me know if need more informations.