xcodebuild can't find cocoapods libraries - xcode

I have an xcode project (build from Unity) that uses cocoapods to install Firebase dependencies. It builds fine through the xcode GUI but not using the xcodebuild invocation that I use for automated builds:
xcodebuild -archivePath "$ARCHIVE_PATH" -project "$(pwd)/repo/quantum_unity/Build/$PLATFORM/Unity-iPhone.xcodeproj" -sdk iphoneos -allowProvisioningUpdates -scheme 'Unity-iPhone' -configuration 'Release Development' archive DEVELOPMENT_TEAM=$TEAMID
The build fails to find the FirebaseCore library in linking.
What needs to change in how I invoke xcodebuild so it's able to find the pods installed by cocoapods?
I'm using xcode version 9.4.1.

Use -workspace and the xcworkspace instead of the project.
After installing via CocoaPods and depending on them, always use the Xcode workspace instead of the project.

Related

Xcode build succeeds however it does not downloads app on the simulator

Xcode build succeeds however it does not download app on the simulator through terminal.
I am using the below command in mac terminal to build my code, however, the build succeeds but the app does not get downloaded to my ios simulator as it does using the xcode application
xcrun xcodebuild -workspace MyApp.xcworkspace -scheme "Test App" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.2'
How can i successfully pull my code from Github and then successfully deploy on ios simulator with few lines?
After you build your content, run xcrun simctl install <UDID> <PATH> to install the app in the sim. Be sure you have booted it first as well ( which you can also use simctl for).

Jenkins&Xcode : Build crashes in ipad frequently

I'm currently generating an ios app with distribution profile. When I generate an ipa file from Xcode it works fine without any crashes when installed on an ipad but it crashes in most fields when generated from jenkins as a part CI process. Till now its working fine but the issue started while adding developed frameworks to the project. In jenkins I'm using below command line script for xcodebuild.
. xcodebuild -workspace ~/.jenkins/jobs/workspace/repo/Source/App/App.xcodeproj/project.xcworkspace -scheme App -configuration "release" -sdk iphoneos VALID_ARCHS="armv64 armv7 armv7s i386" archive PROVISIONING_PROFILE="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx" CODE_SIGN_IDENTITY="iPhone Distribution: company Limited" -archivePath ~/Desktop/../App.xcarchive
Unable to find out the exact issue for the crash.
I suggest you to check the environment variable of your jenkins node.. if they are overriding your build variables.
Before this can you provide more details.

Can't run xcodebuild as root

I'm running Xcode 6.4 and trying to build my project using the command line. This works fine without using sudo:
xcodebuild -workspace "project.xcworkspace" -scheme "project"
results in Build Succeeded. However:
sudo xcodebuild -workspace "project.xcworkspace" -scheme "project"
causes the operation to get stuck. I do have Xcode 7.0 Beta installed, is there anyway this could be the issue?
The issue was my schemes were not shared, which caused xcodebuild to get stuck waiting for input
https://github.com/travis-ci/travis-ci/issues/2949

Run installed application on iPad (device) from Mac Terminal

I build the application for iPad (from a Terminal) using:
xcodebuild ARCHS=armv7 ONLY_ACTIVE_ARCH=NO VALID_ARCHS=armv7 -scheme MyApp -sdk iphoneos build
Then I deploy it to my iPad using fruitstrap:
./fruitstrap -b Mobile/DerivedData/MyApp/Build/Products/Debug-iphoneos/MyApp.app/
At the next step I have a problem: I need to run the installed application from a Terminal to be able to run the nightly-iterations on Hudson CI.
Any ideas on how to do it?

parameter for xcodebuild for using latest sdk.

I using ant exec task to execute xcodebuild to build some iOS projects hudson. I would like to be able to crate script that way that allows not to specify sdk version, because after updating sdk on hudson slave or my iOS projects all my projects failing....
There is is nice option in xcode since sdk 4.2 in target setup Base SDK - Latest iOS
and I don't have to provide -sdk param in xcodebuild command, but then (i think) it's taken from xcode project and it's bad because then some one can change target from simulator to device accidentally during commit.
I need something that is constant. I will prefer not to use env variable because I would like to be able to run this ant task also on dev machines and would like not have to renember about setting it on all machines.
Unfortunately xcodebuild -showsdks gives only:
Mac OS X SDKs:
Mac OS X 10.4 -sdk macosx10.4
Mac OS X 10.5 -sdk macosx10.5
Mac OS X 10.6 -sdk macosx10.6
iOS SDKs:
iOS 4.2 -sdk iphoneos4.2
iOS Simulator SDKs:
Simulator - iOS 3.2 -sdk iphonesimulator3.2
Simulator - iOS 4.0 -sdk iphonesimulator4.0
Simulator - iOS 4.1 -sdk iphonesimulator4.1
Simulator - iOS 4.2 -sdk iphonesimulator4.2
I need something like -sdk iphoneosLatest. My only idea is to pare output of xcodebuild -showsdks with some script, but I don't like this idea.
You can use xcodebuild with the latest SDK using :
xcodebuild -sdk iphoneos, for Device
xcodebuild -sdk iphonesimulator, for Simulator.
We use these options for our automated builds and it's been working since XCode 3.2.5
I believe you can use xcodebuild -sdk iphoneos (no version number) to accomplish this.
I tried #jenningj 's solution and it worked for me. Maciek Sawicki, if this works for you, you should mark it as the right solution.
Also, xcodebuild -showsdk should be xcodebuild -showsdks.
You can try: xcodebuild -showsdks | grep -Eo "iphoneos([0-9]{1,}\.)+[0-9]{1,}"

Resources