I am trying to set up CI with gitlab. When I try to build locally, I get this error : xcodebuild: error: 'APP.xcworkspace' does not exist.
"APP" not being the real name. I am also using CocoaPods.
This happens after I run this command in terminal:
gitlab-ci-multi-runner exec shell build_project
I have checked and the file does exist in the same folder I call the command.
This is my .gitlab-ci.yml file:
stages:
- build
build_project:
stage: build
script:
- xcodebuild clean -workspace APP.xcworkspace -scheme APP | xcpretty
- xcodebuild test -workspace APP.xcworkspace -scheme APP -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.2' | xcpretty -s
tags:
- v0.0.1
Xcode version: 8.2.1
Cocoapods version: 1.2.0
Gitlab-runner version : 1.11.0
Alex
On React Native I've solved this issue by running command inside /ios folder.
I have solved this now!!
I just had to update the cocoapods repo, se this link:
https://github.com/CocoaPods/CocoaPods/issues/5077
Looks like your specs repo was edited at some point, and now git can't update it. I'd recommend deleting and re-creating your Specs repo: pod repo remove master and running pod setup
In my case i had project with same folder name("Project") ending with 1 , 2 ,3 ,4 (total 5 folders). when i was trying to install cocoapods in "Project 4" Directory it was getting installed in "Project" instead it should be for "Project 4".
I could find Xcworkspace in the folder "Project"
Hence i need to delete other folders with same name and then install pods in "Project" folder
To share a scheme in Xcode:
Choose Product > Scheme > Manage Schemes.
Share your scheme:
Click on the Close button.
Related
I'm trying to get Github Actions for project with Swift Package Manager dependency working.
I keep getting this error: xcodebuild: error: Could not resolve package dependencies:15 The server SSH fingerprint failed to verify.
... when Actions runs and Resolve Package Graph fetching the dependency in my project that uses Swift Package Manager.
My step it is failing on:
- name: Build and Test
run: |
xcodebuild clean test -project xyz.xcodeproj -scheme xyz -destination "platform=iOS Simulator,OS=13.3,name=iPhone 8" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
I've tried adding for ip in $(dig #8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts per Xcode 11 resolving packages fails with SSH fingerprint but still can't get it to work, I might be putting it in the wrong place or doing it wrong.
Has anyone got this working that can help me?
I had the same problem and decided to use packages with https urls instead of ssh and it worked fine. If you don't need to access private repos then this is a viable solution.
I'm trying to set up Travis CI for my iOS project.
Here is my travis yml file
language: objective-c
env:
matrix:
- export LANG=en_US.UTF-8
script:
- xctool -workspace TravisExample.xcworkspace -scheme TravisExample -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
- xctool test -workspace TravisExample.xcworkspace -scheme TravisExampleTests -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
cache:
- bundler
- cocoapods
Travis failed with errors like this
Support Files/Bolts/Bolts-prefix.pch' file not found
Support Files/AFNetworking/AFNetworking-prefix.pch' file not found
I have AFNetworking and Bolts as dependencies in my project managed by cocoapods.
Any idea how to fix this problem?
Try using this lines before script:
before_install:
- rvm use system
- sudo gem install cocoapods -v '0.39.0'
It looks like some Travis Machines are using old Cocoapods versions. With this lines you force Travis to use the version you want.
Check which version are you using in your machine with this line in your Terminal:
pod --version
I wrote a blog post about Travis-CI, maybe it can help you.
I am building/running an IOS app from command line with following commands:
xcodebuild -sdk "${TARGET_SDK}" -xcconfig "${CONFIG_FILE_PATH}" -configuration Release
/usr/bin/xcrun -sdk "${TARGET_SDK}" PackageApplication -v "${PROJECT_BUILD_DIR}/${APPLICATION_NAME}.app" -o "${OUTPUT_DIR}/${APPLICATION_NAME}.ipa"
Is there any command to clean the targets. or these commands take care of cleaning themselves.
From xcodebuild manual page:
xcodebuild [-project projectname] [-target targetname ...] [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...]
and build action could take following values (UPD 13.08.2018):
action ...
Specify one or more actions to perform. Available actions are:
build Build the target in the build root (SYMROOT). This is the default action, and
is used if no action is given.
build-for-testing Build the target and associated tests in the build root (SYMROOT). This will
also produce an xctestrun file in the build root. This requires specifying a
scheme.
analyze Build and analyze a target or scheme from the build root (SYMROOT). This
requires specifying a scheme.
archive Archive a scheme from the build root (SYMROOT). This requires specifying a
scheme.
test Test a scheme from the build root (SYMROOT). This requires specifying a
scheme and optionally a destination.
test-without-building Test compiled bundles. If a scheme is provided with -scheme then the command
finds bundles in the build root (SRCROOT). If an xctestrun file is provided
with -xctestrun then the command finds bundles at paths specified in the
xctestrun file.
install-src Copy the source of the project to the source root (SRCROOT).
install Build the target and install it into the target's installation directory in
the distribution root (DSTROOT).
clean Remove build products and intermediate files from the build root (SYMROOT).
In your case
xcodebuild -sdk "${TARGET_SDK}" -xcconfig "${CONFIG_FILE_PATH}" -configuration Release clean build
There are two build actions in this command line: 'clean' and 'build'. The 'clean' action is performed first, then the 'build'. As the documentation states, you can specify multiple build actions in a command, and doing so rather than using separate commands ensures that the other options are the same for all the build actions.
You can just delete build folder:
rm -rf ./build
I'm following the practice outlined on this blog post in which an .ipa archive of my xcode project gets built on a slave by a CloudBees Jenkins job.
The slave now appears as a node in my Jenkins configuration and when the job is run, the xcode project is downloaded correctly from CloudBees. However, the job has a problem creating folders in /Applications/xcode.app. I could use some help troubleshooting the following stack trace:
Started by user Wil Pannell
Building remotely on mobile-slave in workspace /Users/WPANNELL/jenkins/workspace/ios-mobile-image-browser
Copied 275 artifacts from "gwt-mobile-image-browser" build number 3
Unable to access upstream artifacts area /home/ventana/hudson_home/jobs/gwt-mobile-image-browser/modules/com.ventana.gwt$mobilebrowser/builds/2013-01-07_20-08-56/archive. Does source project archive artifacts?
Working directory is /Users/WPANNELL/jenkins/workspace/ios-mobile-image-browser/ios/VentanaMobileBrowser.xcodeproj.
[VentanaMobileBrowser.xcodeproj] $ /usr/bin/xcodebuild -version
Xcode 4.5.2
Build version 4G2008a
Fetching marketing version number (CFBundleShortVersionString) from project.
[VentanaMobileBrowser.xcodeproj] $ /usr/bin/agvtool mvers -terse1
No marketing version found (CFBundleShortVersionString).
Marketing version (CFBundleShortVersionString) found in project configuration: .
Fetching technical version number (CFBundleVersion) from project.
[VentanaMobileBrowser.xcodeproj] $ /usr/bin/agvtool vers -terse
No marketing version found (CFBundleVersion)
Technical version (CFBundleVersion) found in project configuration: .
Updating marketing version (CFBundleShortVersionString) to: 2.2.4
[VentanaMobileBrowser.xcodeproj] $ /usr/bin/agvtool new-marketing-version 2.2.4
Setting CFBundleShortVersionString of project project to:
2.2.4.
/Applications/Xcode.app/Contents/Developer/usr/bin/agvtool: line 319: project.pbxproj/project.pbxproj.new1: Not a directory
mv: rename project.pbxproj/project.pbxproj.new1 to project.pbxproj/project.pbxproj: Not a directory
Updating technical version (CFBundleVersion) to: 2.2.4
[VentanaMobileBrowser.xcodeproj] $ /usr/bin/agvtool new-version -all 2.2.4
Setting version of project project to:
2.2.4.
/Applications/Xcode.app/Contents/Developer/usr/bin/agvtool: line 139: project.pbxproj/project.pbxproj.new1: Not a directory
/Applications/Xcode.app/Contents/Developer/usr/bin/agvtool: line 140: project.pbxproj/project.pbxproj.new2: Not a directory
/Applications/Xcode.app/Contents/Developer/usr/bin/agvtool: line 141: project.pbxproj/project.pbxproj.new3: Not a directory
Also setting CFBundleVersion key (assuming it exists)
/Applications/Xcode.app/Contents/Developer/usr/bin/agvtool: line 145: project.pbxproj/project.pbxproj.new4: Not a directory
mv: rename project.pbxproj/project.pbxproj.new4 to project.pbxproj/project.pbxproj: Not a directory
rm: project.pbxproj/project.pbxproj.new1: Not a directory
rm: project.pbxproj/project.pbxproj.new2: Not a directory
rm: project.pbxproj/project.pbxproj.new3: Not a directory
Marketing version (CFBundleShortVersionString) used by Jenkins to produce the IPA: 2.2.4
Technical version (CFBundleVersion) used by Jenkins to produce the IPA: 2.2.4
Going to invoke xcodebuild:target: VentanaMobileBrowser, sdk: iphoneos, project: DEFAULT, configuration: Debug, clean: NO, symRoot: DEFAULT, configurationBuildDir: DEFAULT
[VentanaMobileBrowser.xcodeproj] $ /usr/bin/xcodebuild -target VentanaMobileBrowser -sdk iphoneos -configuration Debug build DSTROOT=. clean install
Build settings from command line:
DSTROOT = .
SDKROOT = iphoneos6.0
xcodebuild: error: 'project.pbxproj' is not a project file.
Build step 'XCode' marked build as failure
Finished: FAILURE
My jenkins xcode configuration was incorrect. I specified the Xcode Project File in the field reserved for the Xcode Project Directory. I'll post back here if I encounter further problems.
I am implementing an app which has a dependency to a command line tool.
This is because there are some presets to do.
The command line tool is responsible to create a sqlite file with all initial information needed by the app (clearly speaking: its just a tool to add some initial data to the app).
Now the problem is, that during debugging everything works fine but if I'll do a release build, some errors occur.
The first error was
target specifies product type 'com.apple.product-type.tool', but there's no such
product type for the 'iphoneos' platform"
This was because my main app had the command line tool as a target dependency.
I solved this by removing the target dependency and added the build to a run script phase:
#Build the initial setup target
xcodebuild -target InitialCoreDataSetup -sdk macosx -configuration $CONFIGURATION
#Run initializing data target to get current sqlite file
cd "$CONFIGURATION_BUILD_DIR"
cd ..
cd "$CONFIGURATION"
current_dir=$(pwd)
./InitialCoreDataSetup "$current_dir" "$SRCROOT" "$CONFIGURATION"
Now the problem is, that I get the following error:
=== BUILD NATIVE TARGET InitialCoreDataSetup OF PROJECT XY WITH CONFIGURATION AdHoc ===
Check dependencies
SDK Configuration Error: no wrapper for product type #
I have absolutely no idea how to fix this.
Any suggestions?
How do you provide your app with an initial sqlite file?
Thanks in advance for any help!
EDIT
At the moment the build phases of my app target are the following:
BTW: I finally got that working by the following line:
#Build the initial setup target
export DYLD_FRAMEWORK_PATH="$SYMROOT/Debug"
/usr/bin/env -i xcodebuild -target InitialCoreDataSetup -sdk "macosx" -configuration Debug OBJROOT="$SYMROOT/Debug" SYMROOT="$SYMROOT"
echo "$SYMROOT/Debug"
#Run initializing data target to get current sqlite file
cd "$SYMROOT/Debug"
./InitialCoreDataSetup "$SYMROOT/Debug" "$SRCROOT" "$CONFIGURATION"
The trick is to start the initialCoreDataSetup always in DEBUG mode
I would suggest letting Xcode do the build in this situation since you should be able to generate the sqllite file by using a build rule to run a script before the other build rules run.