Setup

v1.9.0

Install and initialize the SDK for your testers.

Sample app

BugScreen Travel is a small SwiftUI app that wires up every integration point, with all SDK calls behind an #if DEBUG facade so nothing ships to release.

View on GitHub

Installation

Swift Package Manager

In Xcode, choose File → Add Package Dependencies… and enter the repository URL:

text
https://github.com/bugscreenapp/bugscreen-ios

Or add it to your Package.swift:

Package.swift
swift
dependencies: [
    .package(url: "https://github.com/bugscreenapp/bugscreen-ios", from: "1.9.0")
]

CocoaPods

Add BugScreenSDK to your Podfile:

Podfile
ruby
pod 'BugScreenSDK', '~> 1.9'

Then run pod install.

Requires iOS 15.0+ and Swift 5.9+.

Get your SDK API key

  1. Open Apps in the console. Select your app, or choose New app and then Create app.
  2. Open the SDK tab. An organisation admin can select Reveal beside SDK API key and copy the key.
  3. Replace fb_your_api_key_here in the initialization example below with that key.
Open the console

Setup

BugScreen is for dev/QA, so keep it out of what your end users get. Pick the approach that fits your setup:

No-op pod — keep BugScreen out of release builds (CocoaPods)

Use the real SDK for Debug and the no-op pod for Release. Release builds keep the same API calls but exclude BugScreen’s code, resources and privacy declarations.

Podfile
ruby
pod 'BugScreenSDK',      '~> 1.9', :configurations => ['Debug']
pod 'BugScreenSDK-NoOp', '~> 1.9', :configurations => ['Release']

Then call BugScreenSDK.configure(...) with no guard — release builds resolve the no-op and do nothing.

Swift Package Manager can't scope a dependency to a single build configuration, so this no-op pod swap is CocoaPods-only. On SPM, get the same hard exclusion with the build-setting recipe below — the #if DEBUG guard alone isn't enough.

Exclude BugScreen from release builds (SPM)

  1. Select your app under TARGETS in Xcode, then open Build Settings and select All.
  2. Search for Excluded Source File Names and expand the setting to show build configurations.
  3. Set BugScreenSDK* for Release and every other non-Debug configuration you ship, including custom Prod, Staging or QA configurations.
  4. Keep imports and SDK calls inside #if DEBUG, as shown below.
  5. Build a Release archive. Check that its app bundle has no BugScreenSDK code or resource bundle.
App target → Build Settings → Release
text
EXCLUDED_SOURCE_FILE_NAMES = BugScreenSDK*
Set this on the app target. A project-wide setting also excludes the package’s source files and breaks its build.
Xcode Build Settings with BugScreenDemo selected under TARGETS and BugScreenSDK* in the Release row of Excluded Source File Names.
Select the app under TARGETS and set the Release value. Select the image to enlarge it.

#if DEBUG guard

Compiles out your call sites. On SPM this alone does not remove the SDK — its code, resource bundle, and PrivacyInfo.xcprivacy still ship in release unless you also apply the exclusion above (or, on CocoaPods, the no-op pod).

MyApp.swift
swift
import SwiftUI

#if DEBUG
import BugScreenSDK
#endif

@main
struct MyApp: App {
    init() {
#if DEBUG
        BugScreenSDK.configure(
            apiKey: "fb_your_api_key_here",
            enableScreenshotDetection: true
        )
#endif
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
AppDelegate.swift
swift
import UIKit

#if DEBUG
import BugScreenSDK
#endif

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
#if DEBUG
        BugScreenSDK.configure(
            apiKey: "fb_your_api_key_here",
            enableScreenshotDetection: true
        )
#endif
        return true
    }
}

Tester-flag guard

Runs on production builds for users you flag as testers — useful for dogfooding.

MyApp.swift
swift
import SwiftUI
import BugScreenSDK

@main
struct MyApp: App {
    init() {
        // currentUser.isTester is pseudocode — replace with your tester signal.
        if currentUser.isTester {
            BugScreenSDK.configure(
                apiKey: "fb_your_api_key_here",
                enableScreenshotDetection: true
            )
        }
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Configure screenshot permissions and send your first screenshot report.

Usage

Configuration

Use BugScreen from your assistant with the MCP setup guide.