1
votes

I have a problem with xcode build script, hope you can help.

In older Xcode this script works well but now after upgraded the xcode always failed.

configuration='Release' provision="haithngn_release.mobileprovision" identity="iPhone Distribution: HAITHNGN (TEAMID)"

sdk="iphoneos"
scheme="Mobile"
configuration=$1
version=$2
build=$3
output="$PWD/build/$scheme.$version.$build.$configuration.ipa"

PLIST_PATH="./Mobile/Platforms/ios/Application/"
PLIST_FILE="Info.plist"

/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $version" "$PLIST_PATH/$PLIST_FILE"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $version.$build" "$PLIST_PATH/$PLIST_FILE"

echo "Cleaning up old build..."
rm -Rf "$PWD/build/$configuration-$sdk"

echo "Building $scheme, using $configuration configuration, provisioning = $provision"

xcodebuild -sdk "$sdk" -scheme "$scheme" -configuration "$configuration" clean OBJROOT="$PWD/build" SYMROOT="$PWD/build" ONLY_ACTIVE_ARCH=NO
xcodebuild -sdk "$sdk" -scheme "$scheme" -configuration "$configuration" OBJROOT="$PWD/build" SYMROOT="$PWD/build" ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="$identity"
xcodebuild -exportArchive -sdk "$sdk" "$PWD/build/$configuration-$sdk/$scheme.app" "$PWD/build/$configuration-$sdk/$scheme.ipa" "$provision"
cp "$PWD/build/$configuration-$sdk/$scheme.ipa" "$output"

Terminal Logs:

xcodebuild: error: The flag -exportPath is required when specifying -exportArchive. xcodebuild: error: The flag -exportOptionsPlist is required when specifying -exportArchive. xcodebuild: error: The flag -archivePath is required when specifying -exportArchive.

XCode version 8.3.2

1

1 Answers

1
votes

Starting from Xcode 8.3, you should use xcodebuild -exportArchive instead of xcrun (see there) or apparently, just zipping the App works as well (see there).

Otherwise, you might want to use Fastlane Gym.