Jump to content
Welcome to our new Citrix community!
  • 0

MAM SDK SimpleBrowserApp failed to generate the IPA file.

Eric Dong1709162852


Hi there,


I had downloaded the MAM SDK which contained an iOS Simple Browser App.  I was able to run it in debug mode.  I tried to test out the build process of the MDX and the IPA, so I went Build Phases section and uncomment the build lines to generate the MDX file and the IPA file.  As first, I ran into an issue with the provision profile, so I had updated the signing section of the target project, which fixed the error. 

Now, I get an error of "PhaseScriptExecution failed with a nonzero exit code. "   


When checking the error log.. I'm getting..


CGAppCLPrepTool[49723:359149] Error: embedBundle: bunlde does not exist.

CGAppCLPrepTool[49723:359149] [ToolkitLib] Error: embedBundle: bunlde does not exist.

As I checked the output folder, the mdx file is outputted and I'm missing the IPA file.


Below is the Build Phase code:


# Type a script or drag a script file from your workspace to insert its path.

export STOREURL="http://yourstore.yourdomain.com"

export APPTYPE="sdkapp"

export PACKAGEID="7C1B0619-955F-4078-A4FB-443A52627D67" # uuidgen

#export PACKAGEID="" #Please run uuidgen at the command line and paste the output value in the PACKAGEID variable


export TOOLKIT_DIR="$PROJECT_DIR/../Tools"

export EXECUTABLE_NAME="SimpleBrowser"


if [ -z "${PACKAGEID}" ]


    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



if [ -z "${APPIDPREFIX}" ]


    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


if [! -d $TOOLKIT_DIR/logs ]


    mkdir $TOOLKIT_DIR/logs



echo "Eric - Start to produce MDX file!! "

#"$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"


"$TOOLKIT_DIR/CGAppCLPrepTool" SdkPrep -in "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_FOLDER_PATH" -out "/Users/AppUser/Documents/CitrixSimpleApp/TestApp.mdx" -storeURL "${STOREURL}" -appType "${APPTYPE}"-packageId "${PACKAGEID}" -entitlements "$SRCROOT/$PROJECT/$PROJECT.entitlements" -appIdPrefix "${APPIDPREFIX}" -minPlatform "9.0"


#If you would like to embed your IPA file into the MDX file create the IPA file using the archiving feature of xcode and then use the following command to do so. 

#Provide IPA File Path





"$TOOLKIT_DIR/CGAppCLPrepTool" SetInfo -in "/Users/AppUser/Documents/CitrixSimpleApp/TestApp.mdx" -out "/Users/AppUser/Documents/CitrixSimpleApp/TestApp-exported.mdx" -embedBundle "/Users/AppUser/Documents/CitrixSimpleApp//TestApp.ipa"


I have attached the build log for your review.


Thank you in advance for your help.


Link to comment

6 answers to this question

Recommended Posts

  • 0

Hi Eric,


First off, I would would be cautious in what parts of the logs that are shared. I see a MAC address in the logs as well as local paths. But back to the problem at hand.


The log shows other indicators of problems: 

  1. `.../Tools/Data/treasury.citrix.SimpleBrowserApp_policy_metadata.xml file does not exist`
    1. In the "Tools" directory, you're missing the "Data" sub-directory. This may be in the parent of the "Tools" directory. Just move it into the "Tools" directory. There's an alias/symbolic link, but it may be broken.
  2. `The file “embedded.mobileprovision” couldn’t be opened because there is no such file`
    1. Under "Signing & Capabilities" is the provisioning profile in red? That should be set to a valid one.
    1. In the script, this should be set to your own App ID Prefix/Team ID taken from developer.apple.com in the App IDs section. This could be the reason why the previous error is happening if there is no indication of error there.

Try to fix those and let us know if it solves it or if there are further issues.

Edited by Pablo Arista
Added clarification to where APPIDPREFIX is coming from
Link to comment
  • 0

Thank you for your recommendation.  Here is what I found.


1.  There is a data alias that mapped to the data sub-director.  I have deleted the alias and move the Data sub directory inside the Tools folder.

2.  Everything under the Signing & Capabilities is good (No red).  I'm using our team in Team and Provisioning Profile is set to Xcode Managed profile.

3.  I have copied the team id from developer.apple.com and replace it in the script.

Build SimpleBrowserApp_2021-07-19T11-32-58.txt

After the changes, I'm still getting the same error.

Link to comment
  • 0

Okay I see something else that I didn't notice on the previous log:

Script-6E3D0A7D22440BE30096198B.sh: line 22: [!: command not found

That is in an if clause in the script. It should be:

if [ ! 

there's a space missing between [ and !. I know that this was somewhere in the documentation that was copied as it was recently corrected. Do share the script along with the logs the next time if there are still issues, to be sure there aren't any other script parsing problems.



I still see an error about the xml

Tools/Data/treasury.citrix.SimpleBrowserApp_policy_metadata.xml file does not exist

In Tools/Data/ is there any policy_metadata.xml file? maybe with that name or some other prefix?


Lastly is the arch type: Debug-iphonesimulator. Switch to an actual device. I do believe you can build it, but to make an IPA you will get an error once the other build issues are fixed.


Hopefully that solves the issue. In any case let us know if it persists and we can continue analyzing.

Link to comment
  • 0

Thanks Pablo.


I did fixed the Command not found error.  The script code was posted in my initial posting.


As for treasury.citrix.SimpleBrowserApp_policy_metadata.xml, the directory only has policy_metadata.xml, so I made a copy of the file and rename it.  This problem is now fixed.


As for the switching from debug-iphonesimular setting, this is the original setting from the SDK.  If you would like me to try a new setting, would you please provide the detail steps and I will give it a try.


The build script is still generating the same error.  I have attached the output log for your review.


Thank you.

Build SimpleBrowserApp_2021-07-21T14-51-47.txt


Link to comment
  • 0
On 7/14/2021 at 1:43 PM, Eric Dong1709162852 said:

 -embedBundle "/Users/AppUser/Documents/CitrixSimpleApp//TestApp.ipa"


Hi Eric. I forgot the script was on the post itself. That error message looks like a typo on our tool, but it is referring to something (albeit not so clear). Look here on the IPA path, there are 2 slashes //TestApp.ipa. Remove a slash. Also double check all of the paths for the Tool directory and actually all of the variables in this script. Previous instructions weren't so clear. But it does look like that would be it. Strange about the policy_metadata.xml, but that seems to be the solution then.


You're using the sample from the MAM SDK download, correct? We have the latest version of the sample on the master branch of this repo: https://github.com/citrix/citrix-mam-sdk-sample-browser-app-ios-objc

There was recently a customer who pointed out a compilation error and the repo has the correction in the master branch, but not in the MAM SDK download. In the next release, that would be corrected. Although I'm unsure if we are still going to package it in the download. This repo in GitHub is fairly new and we will be updating it on the next release.


About the simulator, on Xcode just select your device instead of a simulator device. You'll be able to build, but if you want to actually run it and generate an IPA, you won't be able to do any of that. You need to enroll using the Secure Hub app also to test on a real device. I'm assuming you are following the documentation: https://developer.cloud.com/citrixworkspace/mobile-application-integration/mam-sdk-for-ios-and-ipados/docs/overview


In any case, please let us know if there are any other issues/doubts compiling/uploading/running.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...