Step 1: Create a build.json file in the root directory of the project.
Sample of build.json
{
  "ios": {
    "debug": {
      "codeSignIdentity": "iPhone Developer",
      "provisioningProfile": "your-developer-provisioning-profile-UUID-here"
    },
    "release": {
      "codeSignIdentity": "iPhone Distribution",
      "provisioningProfile": "your-distribution-provisioning-profile-UUID-here"
    }
  }
}
Note: The UUID can be obtained by opening the .mobileprovision file on a text editor and search for 'UUID'.
Step 2: Run the following command from the root folder of the project on the terminal
cordova build ios --device --release