Package an iOS app manually on a Mac machine

The MC Enabler utility is provided to simplify and support the re-signing and repackaging of apps.

Prerequisites

The following must be installed on the Mac machine that you use for packaging an iOS app:

  • OS X 10.8 or 10.9 or macOS Sierra 10.11.2, 10.12, 10.12.1, and 10.12.4
  • Xcode 6 or higher

Additional required resources

Copy the following resources to your Mac machine:

MC Enabler

The MC Enabler is located in the Agent directory on the Mobile Center server machine:
Linux:
<Path to your server installation folder>/server/Agent

Windows:
<Path to your server installation folder>\server\Agent

You can also download it by selecting your version of Mobile Center on ADM Marketplace

The MC Enabler tool is available in both GUI and command line versions.

HPMobileCenter.dylib This library enables your apps to work with Mobile Center. The library is included in the MC Enabler package that you can download by selecting your version of Mobile Center on ADM Marketplace. It can also be found in the following location on the Mobile Center server machine:
Linux:<Path to your server installation folder>/server/Agent

Windows: <Path to your server installation folder>\server\Agent
Code signing certificate

This is the certificate your organization uses to code sign apps. The certificate must be installed on the Mac machine that you are using, and can be seen in the Keychain Access program. For more details on the certificates needed, see Certificates required when signing iOS apps.

Code signing provisioning profile This is the mobile provisioning profile that your organization uses to code-sign apps. This is originally a file downloaded from the Apple Developer Member Website and installed on your Mac. For details on how to generate a provisioning profile, see Generate a development provisioning profile.

For hybrid apps only

Copy the following JavaScript files to your testing machine:

Back to top

MC Enabler on Mac

The MC Enabler tool is available in both GUI and command line versions. The GUI version allows you to enter the required values in an accurate and simple manner, using a graphical interface.

For instructions on how to use MC Enabler, select a version:

MC Enabler GUI versionClosed

MC Enabler command lineClosed

MC Enabler on Mac - GUI version

The MC Enabler GUI enables you to re-sign and repackage your apps for the testing of iOS devices.

  1. Extract the files onto your Mac machine from the downloaded MCEnabler.zip package.
  2. Open HPMCEnabler-GUI.app: Ctrl+click or right-click on the app and select Open from the context menu.

    Note: Since the GUI version of HPMCEnabler is not distributed via the Mac App Store, if you try to install it through the App Store, it will issue a security warning indicating that the application cannot be opened since it is from an unidentified developer. Instead, use the method described above.

  3. Fill in all of the fields in the HPMC Enabler.

    User interface elements are described below:

    UI Element Description
    Agent/L - AUT
    The Enabler mode:
    Agent/L mode. For code signing the Agent apps, as described in Re-sign the Agent apps.
    AUT mode. For packaging apps, as described in Package an iOS app manually on a Mac machine.
    Original IPA
    The full path to the original ipa file that you want to re-sign. For example, if you are re-signing the Agent app, enter /<full_path>/HP4M-Agent.ipa
    HPMC Dylib

    In AUT mode only. A library to inject that enables your apps to work with Mobile Center. The library is included in the MCEnabler.zip file. It can also be found in the Agent directory on the Mobile Center server machine.

    JS Folder

    In AUT mode only. The full path to the js folder with the js file to inject.

    Note: Use this only when testing hybrid apps with UFT/ LeanFT / Sprinter/ Performance testing tools . Packages the app with the required JavaScript file/s from the given location on the testing machine.

    Destination
    A destination for the generated files on your Mac machine.
    Provision Profile
    The path to the provisioning profile file on your Mac machine.
    Certificate Name

    A drop-down list of the installed certificates from the Keychain. Select a certificate from the list or click Suggest to get the recommended one. If the certificate is not listed, it is not properly installed on this Mac machine.

    Note: The MC Enabler does not check the validity of the certificate, so you must ensure that it is valid.

    Verbose
    Displays warning and error messages in the text area, if the Agent is not enabled properly.
  1. Click Run. This generates an additional ipa file, customized with your code signing certificate and a provisioning profile.
  2. Upload the new ipa to Mobile Center

    Note: Whenever you upload a new or modified ipa file to the Mobile Center server, as a result of adding or changing an iOS device, make sure to unplug the device and plug it in again.

MC Enabler on Mac - command line version

Use the following syntax when running the Enabler from the terminal command line.

$ <path>/MCEnabler <path>/<original_ipa>.ipa [<options>]

Command line options:

-inject

Inject the dylib into the app. Provide the full path to the HPMobileCenter.dylib.

-codesign

Codesign the app with a certificate. This is the certificate your organization uses to code sign apps. The certificate must be installed on the Mac machine that you are using, and can be seen in the OSX Keychain Access program.

Use the full name of the certificate as shown in the Keychain.

For more details on the certificates needed, see Certificates required when signing iOS apps.

-p Attach a mobile provisioning profile to the App. Provide the path to the provisioning profile on your Mac machine.
-e   Entitlements file.
-r Resources rules list. Your custom resource rules file.
--original-res-rules Use the Resources rules file from the original IPA, ResourceRules.plist.
--generic-res-rules Apply a generic Resources rules definition. If the codesign fails due to problems with the resources, try this option. A generic template will be used.
--force-res-rules Runs the enabler as if the --original-res-rules option was set. If no original rules were found, it runs the enabler as if the --generic-res-rules option was used.
--no-url-scheme    Do not add a unique URL scheme in Info.plist. By default, it is added. The format of scheme is hpmc-(a 32 char uid)
--verify-agent     Issue a warning if the Agent is not enabled properly.
-d destination folder   An optional path to the folder in which to place the new .ipa file. The folder must exist.
-n new file name     An optional name for the new .ipa file.
-v verbose
-V print version
-h print usage
-j path to .js file folder

The full path to the js folder with the js file to inject.

Note: Use this only when testing hybrid apps with UFT , Sprinter or Performance testing tools . Packages the app with the required JavaScript file/s from the given location on the testing machine.

A new ipa file is created. Upload the new ipa to Mobile Center.

Note: Whenever you upload a new or modified ipa file, as a result of adding or changing an iOS device, make sure to unplug the device and plug it in again.


Back to top

Test generated files

After re-signing an agent, we recommend testing the newly-generated ipa before connecting your devices, to check that the agent has been properly enabled for your devices.

  1. Locate a device whose UDID is on the provisioning profile list.
  2. Install the HP4M-Agent.ipa on the device using your application of choice - iExplore, iFunBox, iTunes.
  3. Launch the HP4M-Agent app.
  4. If the Agent doesn't install or run, there is most likely a problem with your code-signing certificate or provisioning profile. Make sure that:

    • The “get-task-allow” entitlement is set to true.
    • All the UDIDs of your devices are included in the list.

    Back to top

    See also: