Skip to main content

Install on iOS

Use your Mobai read-only access token to install MobaiBiometric version 2.3.3 with Swift Package Manager or CocoaPods. React Native apps use CocoaPods. To get a token, contact support at support@mobai.bio.

Moving from the public repositories

Starting with version 2.3.3, Mobai distributes the iOS SDK from Cloudsmith. If your app installs an earlier version from a public source, switch it over:

  • Swift Package Manager: remove the https://github.com/Mobaibio/MobaiBiometricSPM.git package from your project, then add mob.MobaiBiometric from the registry as described below. If you use the local wrapper package, change import MobaiBiometric to import MobaiBiometricCloudsmith.
  • CocoaPods: remove :source => 'https://gitlab.com/mobaibio-public/podspecs.git' from the pod 'MobaiBiometric' line, add the Mobai source lines described in CocoaPods, and run pod install --repo-update.

Apart from the import, the only source change is that the qHD target resolution (.qHD960x540) was removed in 2.3.3; use .hd1280x720 instead. See the SDK changelog.

Swift Package Manager​

You need Swift Package Manager 5.9 or later. The Cloudsmith package identifier is mob.MobaiBiometric; scope.MobaiBiometric in Cloudsmith's generic examples is a placeholder. The registry URL is not a Git package URL, so do not paste it into Xcode's Add Package Dependencies URL field.

1. Configure the registry​

Run this once on each developer Mac or build runner:

swift package-registry set --global --scope mob https://swift.cloudsmith.io/mobai/sdks/

This maps only the mob package scope to Cloudsmith in ~/.swiftpm/configuration/registries.json. It does not store the token. For a shared Xcode project, you can instead commit a registry configuration at YourApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/configuration/registries.json:

{
"authentication": {},
"registries": {
"mob": {
"supportsAvailability": false,
"url": "https://swift.cloudsmith.io/mobai/sdks/"
}
},
"version": 1
}

2. Store your access token​

Add the following entry to your user-level ~/.netrc file. If it already exists, append this entry rather than replacing the file:

machine swift.cloudsmith.io
login token
password YOUR_MOBAI_ACCESS_TOKEN

Replace the placeholder with the token supplied by Mobai, then restrict access to the file:

chmod 600 ~/.netrc

Do not put the token on a command line or in your project. Cloudsmith's setup page shows swift package-registry login with an account API key; the user-level .netrc method above is the tested download flow for a customer entitlement token.

3. Add the package​

If your app is a Swift package, add the registry dependency and product to its Package.swift:

dependencies: [
.package(id: "mob.MobaiBiometric", exact: "2.3.3")
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "MobaiBiometric", package: "mob.MobaiBiometric")
]
)
]

Then run swift package --netrc resolve from the directory containing Package.swift.

If your app is an Xcode project without a Package.swift, create a small local Swift package inside the project. For example, create Packages/MobaiBiometricCloudsmith/Package.swift:

// swift-tools-version: 5.9
import PackageDescription

let package = Package(
name: "MobaiBiometricCloudsmith",
platforms: [.iOS(.v15)],
products: [
.library(name: "MobaiBiometricCloudsmith", targets: ["MobaiBiometricCloudsmith"])
],
dependencies: [
.package(id: "mob.MobaiBiometric", exact: "2.3.3")
],
targets: [
.target(
name: "MobaiBiometricCloudsmith",
dependencies: [
.product(name: "MobaiBiometric", package: "mob.MobaiBiometric")
]
)
]
)

Create Packages/MobaiBiometricCloudsmith/Sources/MobaiBiometricCloudsmith/MobaiBiometricCloudsmith.swift:

@_exported import MobaiBiometric

Add the local package to your Xcode project and link the MobaiBiometricCloudsmith product to your app target. Your app can then import MobaiBiometricCloudsmith. Resolve with the netrc credential provider:

xcodebuild -resolvePackageDependencies \
-project YourApp.xcodeproj -scheme YourApp \
-packageAuthorizationProvider netrc

Use -workspace YourApp.xcworkspace instead of -project YourApp.xcodeproj if your app is built from a workspace. The Mobai iOS sample app uses this local-package layout.

CocoaPods​

Use CocoaPods if your app already manages dependencies with a Podfile, including React Native apps. MobaiBiometric requires iOS 15.0 or later.

1. Store your access token​

Add the following entry to your user-level ~/.netrc file. If the file already exists, append this entry rather than replacing the file:

machine dl.cloudsmith.io
login token
password YOUR_MOBAI_ACCESS_TOKEN

Replace the placeholder with the token supplied by Mobai, then restrict access to the file:

chmod 600 ~/.netrc

This is a different host from the swift.cloudsmith.io entry used by Swift Package Manager. If you use both, keep both entries. On CI, write this file from a secret before running pod install.

2. Add the Mobai spec source​

At the top of your Podfile, add the Mobai source followed by the public CocoaPods CDN, which provides SwiftProtobuf:

source 'https://dl.cloudsmith.io/basic/mobai/sdks/cocoapods/index.git'
source 'https://cdn.cocoapods.org/'

platform :ios, '15.0'

Do not put the token in the source URL. CocoaPods records every source URL in Podfile.lock, so a token in the URL would be committed with the lock file.

3. Add and install the pod​

In a native app, add the pod to your target:

pod 'MobaiBiometric', '2.3.3'

React Native apps do not need this line: @mobaibio/mobai-biometric already depends on MobaiBiometric 2.3.3.

Install the pods:

pod install --repo-update

Troubleshooting​

  • Registry login returns 404: use the ~/.netrc and --netrc steps above for the customer entitlement token; Cloudsmith's account API-key example uses a different credential flow.

  • Xcode cannot authenticate while the terminal can: resolve with xcodebuild -packageAuthorizationProvider netrc as shown above. Xcode may otherwise choose its Keychain credential provider.

  • Package not found: confirm that the token grants access to mobai/sdks and that you used mob.MobaiBiometric version 2.3.3.

  • Unable to find a specification for MobaiBiometric: confirm that the Mobai source line is in the Podfile and that ~/.netrc has an entry for dl.cloudsmith.io, then run pod repo update.

  • The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0 for SwiftProtobuf: Xcode 26 and later reject pod targets below iOS 15.0. Raise them in post_install:

    installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
    if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 15.0
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
    end
    end
    end
  • Found multiple specifications for MobaiBiometric (2.3.3): the version is also listed in the public CocoaPods trunk. The Mobai source is listed first in the Podfile, so CocoaPods uses it; the warning can be ignored.

  • CocoaPods asks for a username or fails to clone the spec repository: the ~/.netrc entry for dl.cloudsmith.io is missing or contains the wrong token.

For more detail, see Cloudsmith's Swift registry guide, CocoaPods guide, and entitlement token guide.