10
xcrun xcodebuild -log -sdk iphoneos PackageApplication "$OUTPUTDIR/$APPNAME.app" -o "$OUTPUTDIR/$APPNAME.ipa" -sign "$DEVELOPER_NAME" -embed "$PROVISIONING_PROFILE"

This is the command now i am using in xcode7.3.1. i updated xcode to 8.0 version. while running this command in terminal I am getting error as "warning: PackageApplication is deprecated, use xcodebuild -exportArchive instead."

is there any alternative command???

SUNiL iOS
  • 129
  • 1
  • 8

1 Answers1

14

In Xcode8, xcrun PackageApplication is deprecated, so I was successful with the use of this way.

#archive
xcodebuild -sdk iphoneos10.0 -project Unity-iPhone.xcodeproj \
-scheme Unity-iPhone \
-configuration Release build \
-archivePath $ARCHIVE_DIRECTORY'/'$APP_NAME'.xcarchive' \
archive

#export ipa
xcodebuild -exportArchive \
-archivePath $ARCHIVE_DIRECTORY'/'$APP_NAME'.xcarchive' \
-exportPath $OUT_PATH'/' \
-exportOptionsPlist exportOptions.plist

And the contents of exportOptions.plist is (for adhoc),

<?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>ad-hoc</string>
    <key>teamID</key>
    <string>YOUR_TEAM_ID</string>
    <key>uploadBitcode</key>
    <true/>
    <key>uploadSymbols</key>
    <true/>
  </dict>
</plist>
Don
  • 3,654
  • 1
  • 26
  • 47
robita
  • 141
  • 2
  • How did you find out what could be the contents of exportOptions.plist ? I have seen dozens of samples on the web and instruction for Xcode GUI from Apple, but as usual not a single place where to refer to if I want to build my own export plist suitable for my goals ;) Thanks. – RAM237 Apr 27 '17 at 18:03
  • Okay, finally I was able to read the instructions in `xcodebuild -help`, but now I don't get how it decides which Provisioning Profile to use for AdHoc export. I will file a new question on SO to see if someone is aware of this. – RAM237 Apr 28 '17 at 07:58
  • 1
    NOTE: `` should be `` – laoyur Jun 11 '17 at 15:23
  • Great answer, still working for me in XCode 11. NOTE: I have found the easiest way to get a working exportOptions.plist file is to export an archive manually from XCode using the desired options, then copy the generated ExportOptions.plist file from the export output directory. – biomiker Apr 30 '20 at 21:23