Contents

bugfender/BugfenderSDK-iOS

Bugfender SDK for iOS, a remote logger tailor-made for mobile

Swift

If your application uses SwiftUI and doesn't have an AppDelegate, you might need to create one like this:

@main
struct YourAppNameApp: App {

    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

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

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        Bugfender.activateLogger("YOUR_APP_KEY")
        Bugfender.enableUIEventLogging() // optional, log user interactions automatically
        Bugfender.enableCrashReporting() // optional, log crashes automatically
        bfprint("Hello world!") // use bfprint() as you would use 
        return true
    }
}

Then you may use BFLog as you would normally use NSLog or print.

You may also want to specify a logging level by using the following helper functions:

  • Bugfender.print(...): Default log.
  • Bugfender.warning(...): Warning log.
  • Bugfender.error(...): Error log.

Objective-C

Make Bugfender available project-wide by adding the following line to the .pch file:

#import <BugfenderSDK/BugfenderSDK.h>

Get an API key from the Bugfender console. In your AppDelegate call activateLogger when the application starts, like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ...
    // Activate the remote logger with an App Key.
    [Bugfender activateLogger:@"YOUR_APP_KEY"];
    [Bugfender enableNSLogLogging]; // optional, capture logs printed to console automatically
    [Bugfender enableUIEventLogging]; // optional, log user interactions automatically
    [Bugfender enableCrashReporting]; // optional, log crashes automatically
    BFLog("Hello world!") // use BFLog as you would use NSLog
    ...
}

You may use BFLog as you would normally use NSLog.

You may also want to specify a logging level by using the following macros:

  • BFLogFatal(...): Fatal log.
  • BFLogErr(...): Error log.
  • BFLogWarn(...): Warning log.
  • BFLogInfo(...): Info log.
  • BFLog(...): Default (debug) log.
  • BFLogTrace(...): Trace log.

Documentation

For information on how to use our SDK, you can check the documentation to configure your project.

Package Metadata

Repository: bugfender/BugfenderSDK-iOS

Homepage: https://bugfender.com

Stars: 83

Forks: 29

Open issues: 4

Default branch: main

Primary language: objective-c

License: Other

Topics: bugfender, cocoapods, ios, ios-swift, logging, objective-c, sdk

README: README.md