AnyBio
Guides

Configuration

SDK Initialization

BioSDK is initialized asynchronously. The initialize call loads supported devices from the AnyBio platform and prepares the BLE subsystem.

import BioSDK

let config = BioSDKClient.Configuration(
    environment: .auto,
    organizationKey: "org_your_key",
    projectKey: "proj_your_key"
)

let sdk = try await BioSDKClient.initialize(configuration: config)

Configuration Options

environment

Controls which AnyBio API endpoint the SDK connects to.

ValueBehavior
.autoReads BIO_INGEST_BASE_URL from your app's Environment.plist.
.productionUses the AnyBio production endpoint.

organizationKey

Your organization identifier (prefixed with org_). Provided when you register with AnyBio.

projectKey

Your project identifier (prefixed with proj_). Each project groups sessions, devices, and data under a single namespace.

Environment.plist

Create an Environment.plist file in your app bundle to configure environment-specific settings:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>BIO_INGEST_BASE_URL</key>
    <string>https://api.anybio.io</string>
    <key>DEVELOPER_KEY</key>
    <string>org_your_key</string>
    <key>PROJECT_KEY</key>
    <string>proj_your_key</string>
    <key>ENVIRONMENT</key>
    <string>production</string>
</dict>
</plist>

Multiple Environments

Create separate plist files for each environment and switch them via Xcode build configurations or schemes:

FileBase URLUse case
Environment.plisthttps://api.anybio.ioProduction
Environment-beta.plisthttps://beta.api.anybio.ioSandbox

OAuth Configuration (Optional)

If your app uses AnyBio's OAuth provider integration:

sdk.configureOAuth(
    callbackURLScheme: "yourapp",
    userTokenProvider: {
        // Return the current user's access token from your keychain
        KeychainHelper.load(key: "accessToken")
    }
)

Register your callback URL scheme in Info.plist:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>yourapp</string>
        </array>
        <key>CFBundleURLName</key>
        <string>com.yourcompany.yourapp.oauth</string>
    </dict>
</array>

Client Info

The SDK automatically collects non-sensitive client metadata and sends it with session requests for diagnostics:

  • App name, version, and build number
  • OS name and version
  • Device model
  • SDK version

Access this information at any time:

let info = sdk.clientInfo
// ["sdk_version": "2.0.0", "os_version": "17.2", "device_model": "iPhone 15 Pro", ...]

On this page