MDX policy file

Background

An MDX file contains policies and metadata about the application. It will contain the app or a link to the app depending on the distribution method (see Distribute Apps).

Note

For information about the app policies that are available for MAM SDK policies for third-party iOS apps, see MAM SDK policies for third-party apps for iOS. As a reference see the Create MDX File script found in the sample Simple Browser App to produce the .mdx file as part of the build process.

Prerequisites

Download MAM SDK

Create an iOS Application

Integrate the MAM SDK into your iOS Application

Add the SDK Initialization Code.

Copy “Tools” & “Data” to project

The downloaded MAMSDK zip file includes 2 directories: Tools and Data. This contains a CGAppCLPrepTool with special options for use with the MAM SDK.

MAM SDK zip contents

Ensure you have copied both the Tools and Data directories into the root of the project.

MAM SDK directories copied

Add New Script

Add Build Phase Step to Prepare the MDX file.

Navigate to TARGETS→Target→Build Phases. Add New Run Script Phase by clicking the + sign to the right of the project.

Add MDX Prep Script

Copy the following script to the clipboard:

 #WARNING: Ensure that no hidden characters are added to the file in the process of copying contents. Some editors will add formatting data when copying from them.
    export STOREURL="http://yourstore.yourdomain.com" #STOREURL can be set to any URL during development (e.g., http://yourstore.yourdomain.com). The URL may need to be changed later depending on the distribution method selected.
    export APPTYPE="sdkapp" #APPTYPE should be set to sdkapp for apps that use the iOS MAM SDK, as this is the only valid option. Since the iOS MAM SDK is built into the app, XCode can prepare the app like any other Apple applications. Consequently less post-build preparation is needed than when performing an MDX app wrapping.
    export PACKAGEID="" #Please run uuidgen on the terminal and paste the output value in PACKAGEID. This has be the same UUID which was generated when adding the URL Type.
    export APPIDPREFIX="" #APPIDPREFIX should be set to the Team ID that is located in the Apple Developer Account.
    export TOOLKIT_DIR="$PROJECT_DIR/Tools"

    if [ -z "${PACKAGEID}" ]
    then
     echo "PACKAGEID variable was not found or was empty, please run uuidgen at the command line and paste the output value in the PACKAGEID variable in your post build script."
     exit 1
    fi

    if [ -z "${APPIDPREFIX}" ]
    then
     echo "APPIDPREFIX variable was not found or was empty, please refer to the \"how to\" document located in the documentation folder of the SDK package on where to find your Apple's application prefix ID."
     exit 1
    fi

    if [ ! -d $TOOLKIT_DIR/logs ]
    then
     mkdir $TOOLKIT_DIR/logs
    fi

    "$TOOLKIT_DIR/CGAppCLPrepTool" SdkPrep -in "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_FOLDER_PATH" -out "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_NAME.mdx" -storeURL "${STOREURL}" -appType "${APPTYPE}" -packageId "${PACKAGEID}" -entitlements "$SRCROOT/$PROJECT/$PROJECT.entitlements" -appIdPrefix "${APPIDPREFIX}" -minPlatform "9.0"
<!--NeedCopy-->

Note

STOREURL is only REQUIRED when an IPA is NOT embedded in the MDX file.

Expand Run Script and paste the script. Edit script by providing values for: STOREURL, APPTYPE, PACKAGEID, APPIDPREFIX.

Create MDX file

Generate MDX File

Verify that the MDX file has been generated. Do the following in Xcode:

  • Build the project.
  • Under Products, right click the generated app and click Show in Finder.
  • Ensure that the .mdx file has been generated.

Create MDX file

MDX policy file