Making IPA from command line xcode 9 - ios

i have many projects embedded in single main project, i am trying to automate the build process. but issue is that i cant make build using command line.
Clean project
xcodebuild clean -project TestingCommandLine.xcodeproj -configuration Debug -alltargets
Make Archive
xcodebuild archive -project TestingCommandLine.xcodeproj -scheme "TestingCommandLine" -configuration Debug -archivePath myApp.xcarchive
Build IPA
xcodebuild -exportArchive -archivePath myApp.xcarchive -exportPath myApp.ipa -exportOptionsPlist exportOptions.plist
the same process works with simple project which does not have any dependencies.
The following build commands failed:
Ld watchos/Watch\ Extension.appex/iskanWatch\ Extension normal armv7k
(1 failure)
This is the actual failure error comes when i try to build.
Any help will be appreciated.

Related

iOS UITests pass on Xcode but fails with xcodebuild

When I run my UITest from XCode they all pass correctly but when I use xcodebuild - some of them fail with error:
Failure: UITestBase.swift:63: Failed to get matching snapshot: Lost connection to the application (pid 43193).
Currently I'm using 11.6, it did work fine on Xcode 10.x, xcodebuild points to correct Xcode where tests pass from IDE
xcodebuild command that I'm using:
xcodebuild clean test -workspace APP.xcworkspace -scheme APPUITests -configuration Release OTHER_SWIFT_FLAGS="-DCOCOAPODS -DAPPProdTarget" -destination "platform=iOS Simulator,name=iPhone 11,OS=13.6"

Carthage Installation: Build Failed Task failed with exit code 65

I'm having an issue when I try to carthage update
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -project /Users/Shared/projectLocation/source/Carthage/Checkouts/ActiveLabel.swift/ActiveLabel.xcodeproj -scheme ActiveLabel -configuration Release -derivedDataPath /Users/main/Library/Caches/org.carthage.CarthageKit/DerivedData/9.4.1_9F2000/ActiveLabel.swift/1.0.1 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/nx/tqnzdw9x5_d73x7tjcmvrv2r0000gn/T/ActiveLabel.swift SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/Shared/projectLocation/source/Carthage/Checkouts/ActiveLabel.swift)
This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/nx/tqnzdw9x5_d73x7tjcmvrv2r0000gn/T/carthage-xcodebuild.LEmVYA.log
I had the same issue, but I resolved.
ActiveLabel.swift was updated on 10/9.
If you use Xcode9, please try to use the tag/0.9.0.
It's written in the below release note.
https://github.com/optonaut/ActiveLabel.swift/releases/tag/1.0.1

xcodebuild - build all targets using command line

I'm using the command line to build all the targets in my project.
I have 3 targets in my project but the build file(.app) is getting created for one target.
Below is script
CONFIG="Ad Hoc"
SDK="iphoneos"
xcodebuild -alltargets -sdk "$SDK" -configuration "$CONFIG"
xcodebuild -project projectname.xcodeproj -alltargets

Build Project From Terminal throws Provisioning Profile error

I am trying to create ipa of my application using terminal.
I am able to successfully build my application, but when converting into an ipa, it throws the following error:
Check dependencies
Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “/Users/xxxx/Downloads/Certificate/xxxx.mobileprovision”, however, no such provisioning profile was found.
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.0'
** ARCHIVE FAILED **
When I try to build the same application using X-Code, it works fine with the same provisioning profile.
The script I am running to build the ipa is
xcodebuild -verbose -project Build_Project_From_Terminal.xcodeproj -scheme nameOfProject -configuration Release -sdk iphoneos clean archive CONFIGURATION_BUILD_DIR="/Users/xxxx/Desktop/xxxx/Project Name/build" PROVISIONING_PROFILE="/Users/xxxxx/Downloads/Certificate/xxxxx.mobileprovision"
EDIT 1:
I have changed my script to
DEVELOPER_NAME="xxxxxxxxx" APP_NAME="xxxxxx"
xcodebuild archive -project $APP_NAME.xcodeproj -scheme $APP_NAME -archivePath ./$APP_NAME.xcarchive
xcodebuild -exportArchive -exportFormat APP -archivePath ./$APP_NAME.xcarchive -exportPath ./$APP_NAME.ipa
iphoneos PackageApplication -v ./$APP_NAME.app -o ./$APP_NAME.ipa --sign $DEVELOPER_NAME --embed ./*.mobileprovision
With this I am getting $APP_NAME.ipa.app as output. When I try to install this, it does not install at all.
Any help will be appreciated.
Please use an alternate method. This is a working example
DEVELOPER_NAME="Your apple developer name"
APP_NAME="application name"
xcodebuild archive -workspace $APP_NAME.xcworkspace -scheme $APP_NAME -archivePath ./$APP_NAME.xcarchive
xcodebuild -exportArchive -exportFormat APP -archivePath ./$APP_NAME.xcarchive -exportPath ./$APP_NAME.ipa
iphoneos PackageApplication -v ./$APP_NAME.app -o ./$APP_NAME.ipa --sign $DEVELOPER_NAME --embed ./*.mobileprovision
Save above shell script in a file (abc.sh) and save that file in your project folder along with your provision profile. Run this script using terminal will save ipa in the project directory.

xcodebuild archiving issue

I'm having an issue with xcodebuild. I use the xcodebuild archive command from a build server to create an archive. At the moment, it seems that it will not respect the build configuration I have set. Has anyone come across this, or have any idea how to alter it?
To give a bit more background, within the project I have my build location set as Legacy so that I can build multiple libraries into a single iOS app (similar to how three20 do it), and so I have my build directories set within an xcconfig file as so:
BUILD_DIR = ../Build
SYMROOT = ${BUILD_DIR}/Products
OBJROOT = ${BUILD_DIR}/Intermediates
TEMP_ROOT = ${BUILD_DIR}/Temp
If I run
xcodebuild -workspace ${WORKSPACE} -scheme ${SCHEME} -configuration ${CONFIGURATION} -sdk ${SDK}
It all works swimmingly, and the compilation command I get compiles into the common ../Build folder as you can see in the sample output here:
CompileC ../Build/Intermediates/Core.build/Release-iphoneos/Core.build/Objects-normal/armv7s/NumberUtils.o Source/NumberUtils.m normal armv7s objective-c com.apple.compilers.llvm.clang.1_0.compiler
However if I add archive on the end, and run:
xcodebuild -workspace ${WORKSPACE} -scheme ${SCHEME} -configuration ${CONFIGURATION} -sdk ${SDK} archive
It ignores my build settings, and just uses the DerivedData location:
CompileC /Users/user/Library/Developer/Xcode/DerivedData/workspace-bmancqbwwpbxuzbdtxezsoptpyur/ArchiveIntermediates/Release/IntermediateBuildFilesPath/Core.build/Release-iphoneos/Core.build/Objects-normal/armv7/NumberUtils.o Source/NumberUtils.m
Is there something else I need to set? I've set all the environment variables I can think of. Strangely archiving from within xcode itself also works fine. Any advice?

Resources