Manually integrate SDK

This topic introduces how to manually integrate the IAPMiniProgram SDK into an iOS Xcode project, without using CocoaPods. Follow the procedure to complete the integration.

Prerequisites

Before you begin, make sure that:

  • To run mini-programs, your device needs to be iOS 11 or later.
  • Xcode 14.0 or later is installed.
  • You have a valid MiniProgram platform account with SDK download permission.
  • Your project can build successfully before integration.

Procedures

Step 1. Get SDK and resource bundle

Download SDK

  1. Open the MiniProgram platform, sign in with your account
  2. Go to the SDK download page, select the SDK version that matches your project, and download it.

image

SDK overview

The SDK includes a required base/required component, and a set of optional components:

  • The base component is IAPMiniProgram, which must always be integrated.
  • Optional components can be added on demand, e.g. IAPMiniProgram_Video.

For example, The SDK includes IAPMiniProgram and IAPMiniProgram_Video.

The table below lists the mapping between components and the corresponding folder names in the manual SDK package, and the capability that each module provides. Use it to identify which folders to import for each capability.

For more information about SDK components, see the Integrate SDK components topic.

Components

Folder

Capability description

Required

IAPMiniProgram

IAPMiniProgram

Core runtime of the mini-program container.

It includes the framework and resource subfolder.

Yes

IAPMiniProgram/ACManifest

IAPMiniProgram_ACManifest

Provides the capability to parse the mini-program manifest and expose metadata to the container.

It includes the framework and resource subfolder.

No

IAPMiniProgram/ACTranslation

IAPMiniProgram_ACTranslation

Provides on-device translation of mini-program content.

It includes the framework and resource subfolder.

No

IAPMiniProgram/AppleMap

IAPMiniProgram_AppleMap

Provides Apple Map–based map component and location JSAPIs.

It includes the framework and resource subfolder.

No

IAPMiniProgram/BioAuth

IAPMiniProgram_BioAuth

Provides Biometric authentication (Face ID / Touch ID) JSAPIs.

It includes the framework subfolder.

No

IAPMiniProgram/Bluetooth

IAPMiniProgram_Bluetooth

Provides Bluetooth (BLE) discovery, connection, and data exchange JSAPIs.

It includes the framework subfolder.

No

IAPMiniProgram/GoogleMap

IAPMiniProgram_GoogleMap

Provides Google Map–based map component and location JSAPIs.

It includes the framework and resource subfolder.

No

IAPMiniProgram/Inspection

IAPMiniProgram_Inspection

Provides inspection capabilities.

It includes the framework and resource subfolder.

No

IAPMiniProgram/Legacy

IAPMiniProgram_Legacy

Provides Alipay Connect features.

It includes the framework and resource subfolder.

No

IAPMiniProgram/Localization

IAPMiniProgram_Localization

Multi-language resources and locale switching for container UI.

It includes the resource subfolder.

No

IAPMiniProgram/Lottie

IAPMiniProgram_Lottie

Lottie animation rendering inside mini-programs.

It includes the framework and resource subfolder.

No

IAPMiniProgram/Media

IAPMiniProgram_Media

Audio/video capture and playback, including recording JSAPIs.

It includes the framework and resource subfolder.

No

IAPMiniProgram/Operation

IAPMiniProgram_Operation

Mainly includes data monitoring and release management etc. For more information, see Integrate the operation module topic.

It includes the framework and resource subfolder.

No

IAPMiniProgram/Video

IAPMiniProgram_Video

Dedicated video playback component for the <video> tag and video JSAPIs.

It includes the framework and resource subfolder.

No

Step 2. Import SDK

  1. Unzip all frameworks and bundles into the top-level directory of your Xcode project.
  2. In the file dialog, make sure to select Copy items if needed.

image

Step 3. Set framework embed state

  1. Click the General tab of your Xcode project target.
  2. Under Frameworks, Libraries, and Embedded Content, set every applet-SDK-related xcframework to Do Not Embed.

image

Step 4. Add bundles

  1. Locate the bundle files inside the resource directory of each SDK module, as shown in the following example.
  2. Add all bundles to Build Phases → Copy Bundle Resources.

image

Step 5. Add SDK dependencies

  1. Click the Build Phases tab of your Xcode project target.
  2. Under Link Binary With Libraries, add the following system frameworks and libraries:
  • libc++.tbd
  • libicucore.tbd
  • libxml2.tbd
  • libz.tbd
  • libiconv.tbd
  • MessageUI.framework
  • Security.framework

image

Step 6. Set "Other Linker Flags"

  1. Click the Build Settings tab of your Xcode project target.
  2. Under Linking - General → Other Linker Flags, add the following code:
copy
-ObjC

image

Step 7. Add SSZipArchive

The SDK requires SSZipArchive 2.4.3 or later. You can download it from the official GitHub repository, or use the copy bundled with the SDK package.

  1. Download and unzip SSZipArchive.
  2. Copy the extracted files into the top-level directory of your Xcode project. Make sure to select Copy items if needed.
  3. Under Build Settings → Apple Clang - Preprocessing → Preprocessor Macros (GCC_PREPROCESSOR_DEFINITIONS), add the following macros to both Debug and Release:
copy
HAVE_INTTYPES_H
HAVE_PKCRYPT
HAVE_STDINT_H
HAVE_WZAES
HAVE_ZLIB
$(inherited)

image

Step 8. Add SocketRocket

The SDK requires SocketRocket. You can download it from the official GitHub repository, or use the copy bundled with the SDK package.

  1. Download and extract SocketRocket-0.5.1.
  2. Copy the extracted files into the top-level directory of your Xcode project. Make sure to select Copy items if needed.

Step 9. Verify the integration

After completing the previous steps:

  1. Clean the build folder (Product → Clean Build Folder, or Shift + Cmd + K).
  2. Build your project. The build should succeed with no missing-symbol or missing-resource errors.
  3. Launch the app and initialize the SDK. Confirm that no bundle-loading or framework-embedding warnings appear in the console.

If the build fails, check the following common issues:

  • Undefined symbols for SSZipArchive / SocketRocket: verify that the source files are added to your app target's Compile Sources.
  • bundle not found at runtime: verify that every .bundle under each module's resource directory is added to Copy Bundle Resources.
  • dyld: image not found: verify that all SDK xcframeworks are set to Do Not Embed and that -ObjC is present in Other Linker Flags.

Related information