iOS Builds/Ipa Creation No Longer Works from the Command Line

iOS builds / ipa creation no longer works from the command line

Apple got back to me with a solution. As of Xcode 7 we should use xcodebuild instead of PackageApplication to produce the .ipa file.

xcodebuild has a new -exportArchive option to create an .ipa that works more like Xcode Organizer.

So we should now:

  1. build an archive with xcodebuild archive
  2. create the .ipa with xcodebuild -exportArchive

We now build the archive like this:

xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution archive -archivePath $PWD/build/myApp.xcarchive

We now export the .ipa like this:

xcodebuild -exportArchive -archivePath $PWD/build/myApp.xcarchive -exportOptionsPlist exportOptions.plist -exportPath $PWD/build

These two command create the files build/myApp.xcarchive and build/myApp.ipa

Note that xcodebuild -exportArchive requires a -exportOptionsPlist argument that points to a .plist file with export options. For a complete list of what you can put in that plist, run xcodebuild -help. The minimal contents of the file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>YOUR_TEN_CHARACTER_TEAM_ID</string>
</dict>
</plist>

In Xcode 9, you now have to specify more details in exportOptions.plist like below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>provisioningProfiles</key>
<dict>
<key>my.bundle.identifier</key>
<string>My Provisioning Profile Name</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>YOURTEAMID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>

Build IPA from .APP bundle without xcworkspace

I'm trying to do is build the IPA from the command line...

You can use msbuild to build/package an .ipa

/Library/Frameworks/Mono.framework/Commands/msbuild \
AStackOverflowSolution.sln \
/p:Configuration=Ad-Hoc \
/p:Platform=iPhone \
/p:BuildIpa=true

re: Building via the Command Line (On Mac)

For Windows, include the ServerAddress and ServerUser of your macOS build system

/p:ServerAddress="192.168.40.40" 
/p:ServerUser="YourmacRemoteSSHuser"

re: IPA Support in Xamarin.iOS

Xcode building application to ipa from command line

You're selecting the iPhone Simulator SDK in your build script. Switch it to the real SDK.

How to fix Xcode 6.1 error while building IPA

I wish I knew why it works, but here's a fix that worked for me:

Found the fix !

Click on your project > Targets > Select your target > Build Settings
>

Code Signing Resource Rules Path

and add :

$(SDKROOT)/ResourceRules.plist

How to publish ipa which is produced with xcodebuild build command

After some research I found out that when I use xcodebuild build ... and the Enable Bitcode is set to Yes the -fembed-bitcode-marker is added in the OTHER_CFLAGS for the clang. This flag just adds a "bitcode placeholder" instead of the full bitcode. This is done by Apple because the generation of the bitcode could slow down the build. To generate the full bitcode the -fembed-bitcode-marker must be replaced with -fembed-bitcode.

After creating ipa with the full bitcode I was able to publish my application to the App Store.

Another solution to my problem is to use xcodebuild archive ... instead of xcodebuild build ... to build my project and xcodebuild -exportArchive -archivePath <path to the .xcarchive> ... instead of xcrun -sdk iphoneos PackageApplication ... to create my ipa. When using the archive method the -fembed-bitcode-marker is automatically replaced with -fembed-bitcode and my ipa contains binaries with full bitcode.

Create IPA with symbols using xcrun

I'll answer myself -

In Xcode 7 Apple added the ability to specify export options plist file to better control the .ipa file creation.
One of the options there is <key>uploadSymbols</key> that does exactly what I need.

http://www.matrixprojects.net/p/xcodebuild-export-options-plist

Build iOS app and distribute .ipa via TestFlight with Jenkins and Xcode 7

Take a look at this: https://stackoverflow.com/a/32762413/5373468

And if you're not sure it's a bug, you can get a confirmation here too: http://cutting.io/posts/packaging-ios-apps-from-the-command-line/

Xcode Build and Archive from command line

I found how to automate the build and archive process from the comand line, I just wrote a blog article explaining how you can achieve that.

The command you have to use is xcrun:

/usr/bin/xcrun -sdk iphoneos PackageApplication \
-v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" \
-o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" \
--sign "${DEVELOPER_NAME}" \
--embed "${PROVISONING_PROFILE}"

You will find all the details in the article. If you have any questions dont hesitate to ask.



Related Topics



Leave a reply



Submit