UniApp Installation

iOS Installation

Requirements

  • Minimum deployment target: iOS 15.6 or higher.

Prerequisites

Before installing the IDWise Uni Plugin, ensure you have the following:

Required Tools

  • HBuilderX: Download from https://www.dcloud.io/hbuilderx.html
    • Use the App Development Edition
    • Version: 3.1.0 or higher
  • macOS: Required for iOS development
  • Xcode: Latest version recommended

Required Credentials

  • Client Key: Obtain from IDWise dashboard
  • Flow ID: Configure your verification flow in IDWise dashboard

iOS Installation

Step 1: Add the Plugin to Your Project

  1. Copy the idwise-uni-plugin folder to your project's nativeplugins directory:
    YourProject/
    ├── nativeplugins/
    │   └── idwise-uni-plugin/
    │       ├── ios/
    │       │   ├── IDWiseSDK.framework
    │       │   ├── ShieldPtr.framework
    │       │   ├── FingerprintPro.framework
    │       │   ├── IDWiseModule.h
    │       │   ├── IDWiseModule.m
    │       │   ├── IDWiseSDKBridge.swift
    │       │   ├── IDWisePluginProxy.h
    │       │   ├── IDWisePluginProxy.m
    │       │   ├── IDWiseUniPlugin-Bridging-Header.h
    │       │   ├── IDWiseUniPlugin.swiftmodule/
    │       │   └── libIDWiseUniPlugin.a
    │       └── package.json

Step 2: Configure manifest.json

Open your project's manifest.json file and add the following configurations:

2.1 Register the Module

In the app-plus section, add the module reference:

{
  "app-plus": {
    "modules": {
      "idwise-uni-plugin": {}
    }
  }
}

2.2 Configure Native Plugin

Add the native plugin configuration:

{
  "app-plus": {
    "nativePlugins": {
      "idwise-uni-plugin": {
        "__plugin_info__": {
          "name": "IDWise Uni Plugin",
          "description": "IDWise SDK native plugin for uni-app",
          "platforms": "iOS",
          "url": "",
          "android_package_name": "",
          "ios_bundle_id": "",
          "isCloud": false,
          "bought": -1,
          "pid": "",
          "parameters": {}
        }
      }
    }
  }
}

2.3 iOS Permissions

Add required iOS permissions in the app-plus.distribute.ios section:

{
  "app-plus": {
    "distribute": {
      "ios": {
        "privacyDescription": {
          "NSCameraUsageDescription": "Camera is required for document scanning and selfie verification",
          "NSLocationWhenInUseUsageDescription": "Location is used for fraud prevention and security",
          "NFCReaderUsageDescription": "NFC is required to read passport chip data for verification"
        }
      }
    }
  }
}

Step 3: Build Configuration

Ensure your project is set to portrait mode for optimal user experience:

{
  "app-plus": {
    "distribute": {
      "orientation": ["portrait-primary"]
    }
  }
}

Android Installation

Android counterpart to the iOS bridge in this repo. Structurally it plays the
same role IDWiseUniPlugin.xcodeproj plays for iOS: this is the source
project that compiles down to the .aar uni-app's native plugin packaging
expects (declared via integrateType: "aar" in package.json).

What's here

android/
├── build.gradle                                        # Android library module
├── idwise-uni-plugin.aar                               # compiled output — this is what consumers use
└── src/main/
    ├── AndroidManifest.xml
    └── java/com/idwise/uniplugin/IDWiseModule.kt        # mirrors IDWiseModule.m + IDWiseSDKBridge.swift

IDWiseModule.kt exposes the same four methods as the iOS module —
initialize, startJourney, resumeJourney, isDeviceBlocked — with the
same option keys and the same {event, data} callback payload shape, so
existing JS call sites work unchanged on both platforms.

Installation (consuming this plugin in a uni-app project)

You don't need this folder's source to use the plugin — idwise-uni-plugin.aar
is the only binary required. Copy the whole nativeplugins/idwise-uni-plugin/
folder (this android/ dir plus ios/ and package.json) into your project,
then set up the Android side as follows.

  1. Declare the plugin in manifest.json, under app-plus > distribute > android:

    "permissions": ["idwise-uni-plugin"]
  2. Add the private Maven repo to your app module's build.gradle — the
    aar does not bundle the IDWise SDK itself, and nothing in package.json
    can express a custom repository URL, so this step is always manual:

    repositories {
        maven { url 'https://mobile-sdk.idwise.ai/releases/' }
    }

    Check IDWise's Android install docs
    for credentials/access to that repo.

    Fallback: package.json already declares com.idwise:android-sdk:6.9.0
    under _dp_nativeplugin.android.dependencies, which HBuilderX's packaging
    tooling is designed to read and add to the generated project automatically.
    If your generated app module's build.gradle doesn't end up with
    implementation 'com.idwise:android-sdk:6.9.0' for some reason, add it
    there yourself — declaring it twice is harmless.

    NFC chip-reading (com.idwise:nfc) isn't included by default. If you need
    it, add implementation 'com.idwise:nfc:6.9.0' (matching version) yourself.

  3. Use local/offline packaging, not cloud packaging — see
    Cloud packaging caveat below.

  4. Set minSdkVersion to 24+ in your app module (see
    Requirements).

  5. Enable Data Binding in your app module, not just this library — easy to
    miss, and the app will build and run fine until an SDK screen tries to
    render:

    android {
        buildFeatures {
            dataBinding true
        }
    }

    Without this you'll hit, at runtime, only when an SDK activity opens:

    NoClassDefFoundError: Landroidx/databinding/DataBinderMapperImpl

    Android's data-binding compiler only generates that class if the final
    app module
    also has data binding turned on — enabling it solely in a
    library dependency (like this plugin) isn't enough.

  6. Confirm com.alibaba:fastjson is present — most uni-app native
    projects already include it by default. If you hit a
    ClassNotFoundException for com.alibaba.fastjson.JSONObject, add it
    explicitly.

Cloud packaging caveat

uni-app's cloud build (云端打包) resolves _dp_nativeplugin.android.dependencies
against a fixed set of public repos (google(), mavenCentral(),
maven.aliyun.com, jitpack.io). IDWise's SDK's primary host,
https://mobile-sdk.idwise.ai/releases/, is not one of them, so cloud
packaging cannot resolve com.idwise:android-sdk even though it's declared
in package.json — confirmed while testing this plugin end-to-end. Build via
local/offline packaging (a real Android Studio project with the private repo
added to its own build.gradle), the same way this plugin's iOS side assumes
a local Xcode build rather than cloud packaging.

Requirements

  • minSdkVersion 24+ (bumped from 21 — the SDK's Data Binding usage needs it,
    confirmed via a real build), targetSdkVersion 35
  • multiDexEnabled true and dataBinding true in both this module and
    the consuming app module (see Installation)
  • Android Studio Meerkat 2024.3.2+

Did this page help you?