Setup
v1.9.0Install 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.
Installation
Swift Package Manager
In Xcode, choose File → Add Package Dependencies… and enter the repository URL:
https://github.com/bugscreenapp/bugscreen-iosOr add it to your Package.swift:
dependencies: [
.package(url: "https://github.com/bugscreenapp/bugscreen-ios", from: "1.9.0")
]CocoaPods
Add BugScreenSDK to your Podfile:
pod 'BugScreenSDK', '~> 1.9'Then run pod install.
Requires iOS 15.0+ and Swift 5.9+.
Get your SDK API key
- Open Apps in the console. Select your app, or choose New app and then Create app.
- Open the SDK tab. An organisation admin can select Reveal beside SDK API key and copy the key.
- Replace fb_your_api_key_here in the initialization example below with that key.
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.
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.
#if DEBUG guard alone isn't enough.Exclude BugScreen from release builds (SPM)
- Select your app under TARGETS in Xcode, then open Build Settings and select All.
- Search for Excluded Source File Names and expand the setting to show build configurations.
- Set BugScreenSDK* for Release and every other non-Debug configuration you ship, including custom Prod, Staging or QA configurations.
- Keep imports and SDK calls inside #if DEBUG, as shown below.
- Build a Release archive. Check that its app bundle has no BugScreenSDK code or resource bundle.
EXCLUDED_SOURCE_FILE_NAMES = BugScreenSDK*
#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).
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()
}
}
}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.
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.