Archive Build iOS App with XCode Open - ios

I am currently able to adhoc build my iOS app using the following command:
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration AdHoc archive -archivePath /Users/andrewherrick/Desktop/MyApp.xcarchive
It works great when my phone isn't connected to my Mac having XCode recognize it. However, when it's plugged in it always bombs out:
Reason: You cannot archive for the iOS Simulator platform.
Is there anyway I can modify the build command to allow me to NOT have to disconnect my phone everytime I want a fresh adhoc build?

try using the -destination parameter. e.g.:
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration AdHoc archive -archivePath /Users/andrewherrick/Desktop/MyApp.xcarchive -destination generic/platform=iOS

Related

using Jenkins for iOS build

I am new to jenkins, I am trying to build my iOS application on simulator via jenkins. I am using this command,
xcrun xcodebuild -project Name.xcodeproj \
-scheme Name \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,OS=15.5,name=iPhone 12' \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
build
The build is successful but I can't see the application built on my simulator. And How can I build the same app on real device via jenkins?
The command that you are running will build the application FOR the simulator (this usually means that it will build the application for the 64-bit architecture).
That doesn't mean that it will actually copy/install the application to the simulator for you, its literally just building the application with that architecture so that it is compatible with the simulator.
To build for device, replace your destination with -destination generic/platform=iOS you would also need code signing

how to properly archive an ios app xcode 13

Well there are lots of articles/blog on archiving an iOS app, i've tried several of them, but i end up getting one error or the other, I'm setting up CI/CD, and I'm at the stage of archiving my app.
These are the most promising errors i've gotten so far, i say promising cause other errors encountered seem to be dead ends, but the below commands seems to be a step in the right direction.
1st Command
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -sdk iphoneos -configuration AppStoreDistribution -archivePath $PWD/build/MyApp.xcarchive clean archive
Output
error: Signing for "MyApp" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'Decred Wallet' from project 'MyApp')
2nd Command
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -sdk iphoneos -configuration MyApp\ Release -archivePath $PWD/build/MyApp.xcarchive clean archive
Output
error: No profiles for 'com.mydomian.myapp.test' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.mydomian.myapp.test'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'MyApp' from project 'MyApp')
has anyone done this recently, I need some insight please.
also a few steps to this
i already created a direcory mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles and copied my mobile provisioning file there, i also created a keychain and imported my .p12 file into it

xcodebuild Archive failed but xcarchive created

I recently started using On demand resources in my project.To support it i changed my build script so that now i first create an archive and then export it to ipa.
Here are the commands i am using
xcodebuild -project ABC.xcodeproj/ -configuration Debug -scheme "ABC" archive -archivePath bin/debug/ABC.xcarchive
xcodebuild -exportArchive -archivePath bin/debug/ABC.xcarchive -exportPath bin/debug -exportOptionsPlist ABC/content/Info_debug.plist
When i execute first command build runs smoothly but in the end it shows
CreateAssetPackManifestPlist
Creating AssetPackManifest.plist
** ARCHIVE FAILED **
There are no error logs or any other indication which show any problem. Even though it shows archive failed xcarchive file is created and i am able to use it to successfully export to ipa. I also installed and validated the ipa , app runs fine.
So i modified command to
xcodebuild -project AMC.xcodeproj/ -configuration Debug -scheme "ABC" archive -archivePath bin/debug/ABC.xcarchive || exit 0
Now everything is working fine but i am still unsure why command shows "Archive failed". What can be the reasons for it and is it ok to export it to ipa even though it shows archive failed.

Terminal Command build xcode project for 64 bit with all other also

I am using below command :
xcodebuild -project $PROJECT_NAME.xcodeproj -scheme $PROJECT_NAME -sdk iphonesimulator -configuration Debug
xcodebuild -project $PROJECT_NAME.xcodeproj -scheme $PROJECT_NAME -sdk iphoneos -configuration Debug
for building the application it's working but I need to build our application with iphone/ipad retina 64 bit but it' not working.
for combining
lipo -create "${WS_DIR}/Build/Debug-iphoneos/libRPCCore.a" "${WS_DIR}/Build/Debug-iphonesimulator/libCore.a" -output "${WS_DIR}/Build/RPCLib/libCore.a"
I am not able to build the application for ipad/ipahone retina 64 bit application using terminal command. please help to create the build script.
I suspect this is because you have Build Active Architecture Only set for Debug mode, which is the default setting I believe. This is because there is no need to build for all architectures during debugging as the build is expected to run only on the device being used for debugging.
This is normally turned off for release and you can test this from the command line by using -configuration Release.
BTW I don't believe you need to specify the -sdk option to xcodebuild as the build settings should have that covered.

Choose or get xcodebuild destination directory for app

Is there a way I can choose the destination folder (directory) for when I build an iOS app via command line using xcodebuild?
Right now I am using a command like
xcodebuild -sdk iphonesimulator -workspace /<path_to_project>/ios-app/CompanyName-iOS.xcworkspace -scheme AppName -configuration Debug RUN_APPLICATION_TESTS_WITH_IOS_SIM=YES ONLY_ACTIVE_ARCH=NO clean build 2>&1
In the output I see something like
GenerateDSYMFile /Users/<username>/Library/Developer/Xcode/DerivedData/CompanyName-iOS-fcvhojqctgtmvgdaavahmjutbfyy/Build/Products/Debug-iphonesimulator/AppNAme.app.dSYM
Is there a way I could get this location where the app is output to or even specify where I would rather have the app be sent to? I need access to the app to run Appium selenium tests and just having a build execute and run tests is not helpful. Also trying to incorporate jenkins into the mix and need to have commands to fully automate the process
Set the CONFIGURATION_BUILD_DIR Build Setting to be the directory you want.
https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW40
So in your example:
xcodebuild ...cut... CONFIGURATION_BUILD_DIR=<desired dir> ...cut...
use -derivedDataPath path to get compiled output onto specific folder.
xcodebuild -scheme xxx -workspace xxx.xcworkspace ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator -configuration Debug -derivedDataPath ./build build
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html

Resources