1. 安装证书管理插件Keychains and Provisioning Profiles Management

Keychains and Provisioning Profiles Management are plugins that manage local Keychain and iOS certificates

Manage Jenkins -> Manage Plugins

After the installation, restart the Tomcat service. Otherwise the plugin will not take effect \

2. Configure Keychains and Provisioning Profiles Management

Manage Jenkins -> Uncategorized

Get the login.keychain file \

cd ~/Library/Keychains
Copy the code

The login. Keychain file is not available on macOS10.12 or later, only the login.keychain-db file is available. You can copy the file and delete the -db file. You can also create a shortcut called login.keychain. After uploading, the following configuration \ appears

  • Enter the current macOS user’s login Password in the Password field
  • Code Signing Identity Specifies the Identity of the certificate

At present, a debugging certificate and an Ad Hoc publishing certificate are configured on the computer, and of course, an App Store publishing certificate is required later. This operation process is the same, and you can handle it by yourself later. Go to Keychain Access -> Login, find your iPhone Developer and iPhone Distribution certificates, select one of them, then copy the identifier to this location, and save.

Jenkins has the right to use your computer (login.keychain file) to obtain the certificate (certificate identifier) for debugging and publishing the iOS application.

Then get the debugging certificate and the corresponding.Mobileprovision file of Ad Hoc certificate. It is suggested to download it from the Apple developer background. Can also go to/Users / {username} / Library/MobileDevice/Provisioning Profiles to find the path; But if there are too many configuration files, it can be hard to tell which one is which, and the name of the place is marked by the UUID value. To get the corresponding.mobileprovision file, click upload in the same location and the following page will appear: \

The UUID value of the. Mobileprovision file is automatically identified. For Provisioning Profiles Directory Path, depending on the user name currently logged in to macOS \

/Users/{username}/Library/MobileDevice/Provisioning Profiles
Copy the code

The operating steps, can be understood as Jenkins can read in/Users / {username} / Library/MobileDevice/Provisioning Profiles configuration files in the directory, It also knows which configuration file to read (identify the UUID value). Once saved, certificates and configuration files related to the entire iOS engineering project are configured.

3. Install xcode build plug-in Xcode Integration

Manage Jenkins -> Manage Plugins

After the installation, restart the Tomcat service. Otherwise, the plug-in does not take effect

4. Build ipk

  • The new Item

  • Configure the code repository

  • Add Xcode builds

  • Fill in the Development Team ID

** How to obtain the Team ID, login apple background developer.apple.com**\

  • Click on the Setting

  • Check Clean before Build, which means Clean up the environment before build

  • Check the Generate Archive

When selected, the Xcode Schema File input field will prompt When outputting Archive or IPA, you need to specify a scheme. If you use workspace; “Project” is mandatory. Similar to target, fill in the schema to be built. \

  • Select Pack Application, Build and sign. ipa to generate ipA files

Then fill in the following \

Export method: package method, including development, ad-hoc, Enterprise and app-Store

Ipa filename pattern: specifies the naming rule of an IPA file. If this rule is not specified, the default rule is target-version-build, for example, XXX-1.0.0-2. ipa. You can use VERSION, {VERSION}, VERSION, {BUILD_DATE} (YYYy.mm. Dd) and other built-in system variable values to combine the final name, or you can write a fixed name. Note there is no need to fill in the suffix. Ipa, Jenkins will automatically add it.

Output directory: indicates the IPA Output directory. It is a relative path to CONFIGURATION_BUILD_DIR, the default Build directory, or the modified Build directory.

6. Code Signing & OS X keychain options configuration

  • Code Signing setting…

  • Select Read from Xcode Project and Unlock Keychain

Select Unlock Keychain \

Keychain path: specifies the path of the login. Keychain file. Find login.keychain. The path of the login.keychain file is usually

${HOME}/Library/Keychains/login.keychain
Copy the code

Keychain password: indicates the Keychain password

To sign IPA, the current Mac user must grant permission. You are advised to select this option and enter the password of the current Mac user in Keychain Password.

7. Configure Advanced Xcode build options

  • Click Advanced Build Settings

Then fill in the following \

Xcode Project Directory: this Directory specifies the Directory containing xcodeProj files \

Xcode Project File: If you need to build a Project; Instead of a workspace, specify the name of the file (file with suffix xcodeProj)

Build Output Directory: This parameter simply indicates the dynamic package that will eventually be generated. The default path of files such as IPa and APP is the directory where xcodeProj of the compiled project is located. If the main project and POD project are integrated, they will be located in the directory where XcodeProj of the main project and POD project is located (the default directory of related files generated by compilation is CONFIGURATION).

OBJROOT is the directory where.a and.hmap files are generated. The default path is the directory where xcodeProj is compiled. If the main project and POD project are integrated, xcodeProj of the main project and POD project will be stored in the directory. See the official documentation for the relationships between OBJROOT, CONFIGURATION_BUILD_DIR, and SYMROOT.

8. Collect IPK results

Constructed IPK packages are typically located in the build directory. For example, \

build/**/*.ipk
Copy the code