I'm looking for a way to automate the "Build and Archive" and "Organizer->Share.." for my OSX Mac App Store builds. I have read through "Xcode “Build and Archive” from command line" which is specific to iPhone development, and I'm hoping something similar can be done for my builds.
question from long ago.
It looks like now you can use Application Loader to upload binaries in addition to using XCode. Buried in the (PDF!) documentation for Application Loader is reference to a Unix build tool embedded deep in the package.
It means I can add some code to my build Makefile:
ALTOOL:="/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool"
$ALTOOL --validate-app -f Surfwriter.app.zip -u $APPSTORE_USERNAME -p $APPSTORE_PASSWORD
$ALTOOL --upload-app -f Surfwriter.app.zip -u $APPSTORE_USERNAME -p $APPSTORE_PASSWORD
Of course, before you submit Surfwriter.app.zip you have to build the binary and sign it (should be able to use xcodebuild for that)
This should theoretically do the trick for you.
Related
I have mac descktop app(flutter, small obfuscator for objective-c code). after obfuscation of the source code, the user builds a ios library in XCode. is it possible to start the build process from my application?
These my options are:
Xcode Command Line Tools - it's very similar, but looks a bit complicated.
Also, I don't know yet how to use the terminal (terminal commands) in the desktop application - is it even possible?
fastlane -this tool is more for deployment. can i use this to build locally?
What do you recommend? maybe there are other options?
read below documentaion and set flutter path so it can be runable in terminal or you can get help from youtube to set flutter path
then simply open terminal and run below comands one by one
1.open -a simulator
this command open ios emulator
write cd and drag your project folder path
cd .../example
flutter run
✅your app launch in emulator
flutter path set details
https://docs.flutter.dev/get-started/install/macos
Is it possible to go from an .xcarchive bundle to an .app bundle without using the Xcode Organizer? I'd like to create an automated build and get the final .app file that I can distribute. Using xcodebuild with the archive target works great for getting the .xcarchive file, but not for the final app.
With the iOS SDK, there's a PackageApplication tool you can use with xcrun, but this doesn't appear to exist with the OS X SDK.
I'd also like to do this so I can hopefully get more diagnostics from the Distribution process, which is failing for me right now with the infamous 100021 OS error code.
Have you looked inside the .xcarchive bundle? It's just a folder. Your .app targets should be inside, in a Products subfolder.
In Finder, right-click the archive and click Show Package Contents. in Terminal, use cd.
Try the -exportArchive flag in the xcodebuild command:
xcodebuild -exportArchive -exportFormat app -archivePath <path to .xcarchive> -exportPath "My App.app" -exportSigningIdentity "Developer ID Application: My Software Company"
This command is present in Xcode 5.0.1. See the man page for more details on the optional arguments. This example exports a Developer ID signed application.
Here is what I have discovered about this issue:
As previously suggested, the xcodebuild's archive buildaction is good for getting the .xcarchive, but there does not appear to be an actual way to perform the validate or distribution commands from the command-line. I hope this eventually turns out to be false.
I was able to trick the validation tool by removing the embedded symbolic links in the embedded framework directories. This works, but after discussing with Apple support it turns out this is tricking the tool and not actually producing a valid result.
Apple support says they see this error code if one of the .plist files in an embedded framework is invalid. It turns out, in my example, I had 3 embedded frameworks and 1 of them had an empty .plist file, likely from me hand-building the project. After fixing that, the build would continue happily.
In my project i have Frameworks different for iPhone Simulator and iPhone Device for example like in Rest kit "libRestKit_simulator.a" for simulator and "libRestKit.a" for device,
My requirement is to write a "Run Script" in Xcode to include the frameworks based on the Simulator or device.
Not sure if this is the best solution but it appears to work for me.
If you add a build script below target dependancies then add in the following code. This assumes you have 2 libraries
library.a
library_simulator.a
The project would be set up to use library.a and if you are using the simulator the script will remove library.a and replace it with library_simulator.a. You would need to add the simulator to your build scheme to make sure it is built when doing a build and both libraries would need the same interface.
if [[ "${SDKROOT}" == *Simulator* ]]
then
if [[ -f "${BUILT_PRODUCTS_DIR}/library.a"]]
then
rm -rf "${BUILT_PRODUCTS_DIR}/library.a"
fi
mv "${BUILT_PRODUCTS_DIR}/library_simulator.a" "${BUILT_PRODUCTS_DIR}/library.a"
fi
Not sure how much use this is to you, I only tested it briefly. Hope it helps.
My name is Luca and I am currently working on iOS continuous integration to build apps in xcode for distribution (Ad Hoc and App Store) using shell-scripting.
So far I achieved good results with IPA files. My problem comes for distribution in App Store. To build a .app from script (passing some arguments) I do:
xcodebuild -scheme myScheme -configuration myConfiguration PRODUCT_NAME=myProductName TARGETED_DEVICE_FAMILY=myTargetedDeviceFamily .... etc
Since with XCode 4.2, apps submission is done using the XCode Organizer Window I must be able also to archive my executable.
Therefore I modify the previous command line as follow:
xcodebuild -scheme myScheme -configuration myConfiguration PRODUCT_NAME=myProductName TARGETED_DEVICE_FAMILY=myTargetedDeviceFamily .... etc **archive**
Unfortunately after I do so, it seems that the 'archive' argument force xcodebuild to ignore the other ones (PRODUCT_NAME, TARGETED_DEVICE_FAMILY, ....) and my output is built using the XCode predefined build settings.
I want to be able to pass the arguments with xcodebuild and be effective, but the 'archive' action seems to prevent this.
I am going nuts, please help :)
Thanks
The archive action for xcodebuild seems to have a bug in Xcode 4.2. Normally overrides for the project configuration can be specified as either command-line parameters or via the -xcconfig parameter.
Although the build action honors them, archive does not. (Presumably this is because archive is a meta-action that invokes build internally, but doesn't pass-through the options to the internal invocation.) There is an OpenRadar bug that describes this issue, so presumably it's been reported to Apple.
Finally, note that if you're going to use the archive action from a script then you can't rely on the exit code from xcodebuild. The archive action always yields an exit code of 0 (success, by convention). To detect build failure you need to scrape the output.
I've ran into this same issue. My current work-around is basically to delete the other configurations so archive is forced to use the one you want. Not really a solution that can be done via command-line, hopefully Apple will fix this glaring issue.
this may be too late for the original poster, but may help others. for my build process, i use xcodebuild to with first clean and then build, then i use xcrun to create the archive:
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "build/<Path_to_build_dir>/<App_Name>.app" -o "<Path_to_archive_output>.ipa" --sign "<signing identity>" --embed "<path to provision profile>.mobileprovision"
with this command, i can create an archive for the app store, or even upload an ad-hoc build to TestFlight like this:
curl http://testflightapp.com/api/builds.json \
-F file="<path to archive>" \
-F api_token='<api token>' \
-F team_token='<team token>' \
-F notes='Automated build' \
-F notify=True \
-F distribution_lists='me'
this works as of xcode 6.1
I have a build script calling xcodebuild. that works, but I want to also run the project from bash as well. Effectively I want to negate the need to click "Build and Run" button from the GUI. I'm looking at xcrun but it's not too obvious to me what to do
It sounds like you want to run the product of the build, not the project itself. If you want to do that, you just need to use the bash invocation for the product. If you're building a command-line program, then there will be an executable with the product's name in the project's built products directory after a succesful build. The project's built products directory depends on your preferences for Xcode and the project, but can be determined from the $BUILT_PRODUCTS_DIR environment variable within an Xcode build phase.
I do this for one of my projects in a shell script. It let's me remotely build over SSH.
xcodebuild clean
xcodebuild
cp -rp ~/Projects/VSM/Mac/iCar/build/Release/iCar.app ~/Desktop/
open ~/Desktop/iCar.app
I chose to copy the app to the Desktop on purpose but you wouldn't have to.
try open xcode