/

Quick Start - Monitor for iOS

Get ByteHide Monitor protecting your iOS application in under 5 minutes using cloud zero-config setup.


Prerequisites


Step 1: Install Monitor

Add to your Podfile:

Ruby
target 'YourApp' do
  pod 'ByteHideMonitor'
end

Then run:

Bash
pod install

From now on, always open the .xcworkspace file (not .xcodeproj).

Using Swift Package Manager

  1. In Xcode, go to File > Add Package Dependencies...
  2. Enter URL: https://github.com/bytehide/ByteHideMonitor-iOS
  3. Select Up to Next Major Version and click Add Package
  4. Add to your target

Then run the one-time setup script from your project directory:

Bash
bash <(curl -sL https://raw.githubusercontent.com/bytehide/ByteHideMonitor-iOS/main/Scripts/setup.sh)

For detailed SPM setup instructions, see the full SPM installation guide.


Step 2: Configure Your Token

Create monitor-config.json in your project root (same directory as your .xcodeproj):

JSON
{
  "apiToken": "bh_your_project_key"
}

Make sure the file is included in your app target's Copy Bundle Resources.

Alternative token methods

You can also configure the token via Info.plist or environment variable (BYTEHIDE_TOKEN). See Configuration API for all options.


Step 3: Build and Run

Build your project in Xcode. You should see in the build log:

CODE
ByteHide Monitor: Assembly signed successfully

And in the runtime console:

CODE
[ByteHideMonitor] Initializing...
[ByteHideMonitor] Validating signature
[ByteHideMonitor] Signature validated successfully
[ByteHideMonitor] Configuring...

Auto-Initialization

Monitor for iOS auto-initializes using the Objective-C +load() method, which executes before main(). This means protection is active from the earliest point of your app's execution. No code changes required in cloud configuration mode.


What Happens at Runtime

  1. During build, the token is validated and configuration is embedded in the app bundle
  2. At runtime, Monitor auto-initializes before main() via +load()
  3. Validates the app signature and activates configured protections
  4. Syncs with the ByteHide dashboard for configuration updates

Token Resolution Order

Monitor resolves the project token in this order:

  1. BYTEHIDE_MONITOR_TOKEN environment variable
  2. BYTEHIDE_TOKEN environment variable
  3. apiToken value in monitor-config.json
  4. ByteHideMonitor > APIToken in Info.plist
  5. Code configuration (BHMMonitor.configure())

Default Behavior

With just the token configured, Monitor will automatically initialize, create a session with ByteHide cloud, enable mobile protections (Jailbreak, Simulator, Debugger, ClockTampering) with log action, send incidents to the cloud dashboard, and receive real-time configuration updates via heartbeat.


Next Steps

Previous
Introduction