iOS SDK
Integrate BugScreen into your iOS app in minutes
Installation
Coming Soon
Swift Package Manager URL and CocoaPods support will be available shortly. Check back soon for installation instructions.
Setup
SwiftUI App
Initialize BugScreen in your App struct:
import SwiftUI
import BugScreenSDK
@main
struct MyApp: App {
init() {
BugScreenSDK.configure(
apiKey: "fb_your_api_key_here",
enableScreenshotDetection: true, // Default: true
enableLogging: false // Default: false
)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}UIKit App
Initialize BugScreen in your AppDelegate:
import UIKit
import BugScreenSDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
BugScreenSDK.configure(
apiKey: "fb_your_api_key_here",
enableScreenshotDetection: true,
enableLogging: false
)
return true
}
}Photo Library Access (Optional)
If you want users to manually attach screenshots, add this to your Info.plist:
<key>NSPhotoLibraryUsageDescription</key>
<string>Attach screenshots to bug reports to help us fix issues faster</string>Note: iOS privacy guidelines prevent automatic screenshot access. Users can optionally select screenshots via the system photo picker.
Usage
Automatic Screenshot Detection
When users take a screenshot, BugScreen automatically presents the bug report UI. No additional code required!
Manual Triggering (SwiftUI)
Present the bug report screen programmatically:
Button("Report Bug") {
BugScreenSDK.presentBugReport()
}
// With pre-attached screenshot
Button("Report with Screenshot") {
BugScreenSDK.presentBugReport(screenshot: myImage)
}
// With custom metadata
BugScreenSDK.presentBugReport(
screenshot: myImage,
customMetadata: [
"screen": "CheckoutView",
"userId": currentUserId
]
)Manual Triggering (UIKit)
@IBAction func reportBugTapped(_ sender: UIButton) {
BugScreenSDK.presentBugReport(from: self)
}
// With screenshot
BugScreenSDK.presentBugReport(
from: self,
screenshot: myImage
)Logging
Add context to bug reports with application logs:
BugScreenSDK.log("Detailed debug info", level: .verbose)
BugScreenSDK.log("Debug message", level: .debug)
BugScreenSDK.log("User tapped checkout button", level: .info)
BugScreenSDK.log("Network request took longer than expected", level: .warn)
BugScreenSDK.log("Payment failed: \(error.localizedDescription)", level: .error)Logs are automatically included with every bug report. The SDK maintains a 1MB circular buffer of the most recent logs.
Lifecycle
// Check if SDK is configured
if BugScreenSDK.isConfigured {
// SDK is ready to use
}
// Optional: Shutdown SDK (usually not needed)
BugScreenSDK.shutdown()Configuration
| Option | Default | Description |
|---|---|---|
| apiKey: String | Required | Your API key from the BugScreen console (must start with "fb_") |
| enableScreenshotDetection: Bool | true | Auto-detect screenshots and present bug report UI |
| enableLogging: Bool | false | Enable debug logs to console (use false in production) |
What Gets Collected?
BugScreen automatically collects device and app information with each report:
- •Device model & name
- •iOS version & system name
- •App version & build number
- •Bundle identifier
- •Screen resolution & scale
- •Screen bounds (points)
- •Memory (total & available)
- •Device locale
- •SDK version
- •Custom metadata (optional)