Quick Start - Monitor for iOS
Get ByteHide Monitor protecting your iOS application in under 5 minutes using cloud zero-config setup.
Prerequisites
- Xcode 14+ with CocoaPods or Swift Package Manager
- A ByteHide account with a Monitor project (create one here)
- Your ByteHide Project Token from cloud.bytehide.com
Step 1: Install Monitor
Using CocoaPods (Recommended)
Add to your Podfile:
target 'YourApp' do
pod 'ByteHideMonitor'
endtarget 'YourApp' do
pod 'ByteHideMonitor'
endThen run:
pod installpod installFrom now on, always open the .xcworkspace file (not .xcodeproj).
Using Swift Package Manager
- In Xcode, go to File > Add Package Dependencies...
- Enter URL:
https://github.com/bytehide/ByteHideMonitor-iOS - Select Up to Next Major Version and click Add Package
- Add to your target
Then run the one-time setup script from your project directory:
bash <(curl -sL https://raw.githubusercontent.com/bytehide/ByteHideMonitor-iOS/main/Scripts/setup.sh)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):
{
"apiToken": "bh_your_project_key"
}{
"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:
ByteHide Monitor: Assembly signed successfullyByteHide Monitor: Assembly signed successfullyAnd in the runtime console:
[ByteHideMonitor] Initializing...
[ByteHideMonitor] Validating signature
[ByteHideMonitor] Signature validated successfully
[ByteHideMonitor] Configuring...[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
- During build, the token is validated and configuration is embedded in the app bundle
- At runtime, Monitor auto-initializes before
main()via+load() - Validates the app signature and activates configured protections
- Syncs with the ByteHide dashboard for configuration updates
Token Resolution Order
Monitor resolves the project token in this order:
BYTEHIDE_MONITOR_TOKENenvironment variableBYTEHIDE_TOKENenvironment variableapiTokenvalue inmonitor-config.jsonByteHideMonitor > APITokeninInfo.plist- 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.