diff --git a/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj b/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj index 4c7cb01a..3393a739 100644 --- a/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj +++ b/Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ 55684F7E2553B4C700F82F34 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55684F7C2553B4C700F82F34 /* LaunchScreen.storyboard */; }; 55684F812553B4C700F82F34 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 55684F802553B4C700F82F34 /* main.m */; }; 55684F8D2553B7E100F82F34 /* RollbarDeploys in Frameworks */ = {isa = PBXBuildFile; productRef = 55684F8C2553B7E100F82F34 /* RollbarDeploys */; }; - 55684F8F2553B7E800F82F34 /* RollbarKSCrash in Frameworks */ = {isa = PBXBuildFile; productRef = 55684F8E2553B7E800F82F34 /* RollbarKSCrash */; }; 55684F912553B7EE00F82F34 /* RollbarNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 55684F902553B7EE00F82F34 /* RollbarNotifier */; }; 55684F9D2553BD1C00F82F34 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55684F9C2553BD1C00F82F34 /* NetworkExtension.framework */; }; /* End PBXBuildFile section */ @@ -45,7 +44,6 @@ 55684F912553B7EE00F82F34 /* RollbarNotifier in Frameworks */, 55684F9D2553BD1C00F82F34 /* NetworkExtension.framework in Frameworks */, 55684F8D2553B7E100F82F34 /* RollbarDeploys in Frameworks */, - 55684F8F2553B7E800F82F34 /* RollbarKSCrash in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -114,7 +112,6 @@ name = iosAppObjC; packageProductDependencies = ( 55684F8C2553B7E100F82F34 /* RollbarDeploys */, - 55684F8E2553B7E800F82F34 /* RollbarKSCrash */, 55684F902553B7EE00F82F34 /* RollbarNotifier */, ); productName = iosAppObjC; @@ -401,10 +398,6 @@ isa = XCSwiftPackageProductDependency; productName = RollbarDeploys; }; - 55684F8E2553B7E800F82F34 /* RollbarKSCrash */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarKSCrash; - }; 55684F902553B7EE00F82F34 /* RollbarNotifier */ = { isa = XCSwiftPackageProductDependency; productName = RollbarNotifier; diff --git a/Demos/iosAppObjC/iosAppObjC.xcodeproj/xcshareddata/xcschemes/iosAppObjC.xcscheme b/Demos/iosAppObjC/iosAppObjC.xcodeproj/xcshareddata/xcschemes/iosAppObjC.xcscheme index 6522084f..42addaee 100644 --- a/Demos/iosAppObjC/iosAppObjC.xcodeproj/xcshareddata/xcschemes/iosAppObjC.xcscheme +++ b/Demos/iosAppObjC/iosAppObjC.xcodeproj/xcshareddata/xcschemes/iosAppObjC.xcscheme @@ -1,6 +1,6 @@ crashCollector = [[RollbarKSCrashCollector alloc] init]; - //id crashCollector = [[RollbarPLCrashCollector alloc] init]; - - [Rollbar initWithConfiguration:config - crashCollector:crashCollector]; + [Rollbar initWithConfiguration:config]; [Rollbar infoMessage:@"Rollbar is up and running! Enjoy your remote error and log monitoring..."]; diff --git a/Demos/iosAppSwift/iosAppSwift.xcodeproj/project.pbxproj b/Demos/iosAppSwift/iosAppSwift.xcodeproj/project.pbxproj index cb9ebae9..83281358 100644 --- a/Demos/iosAppSwift/iosAppSwift.xcodeproj/project.pbxproj +++ b/Demos/iosAppSwift/iosAppSwift.xcodeproj/project.pbxproj @@ -7,13 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 3B3C439029704BDD0026266C /* RollbarKSCrash in Frameworks */ = {isa = PBXBuildFile; productRef = 3B3C438F29704BDD0026266C /* RollbarKSCrash */; }; 3BDB8240292D2DCE0093AC9D /* iosAppSwiftApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BDB823F292D2DCE0093AC9D /* iosAppSwiftApp.swift */; }; 3BDB8242292D2DCE0093AC9D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BDB8241292D2DCE0093AC9D /* ContentView.swift */; }; 3BDB8244292D2DCF0093AC9D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3BDB8243292D2DCF0093AC9D /* Assets.xcassets */; }; 3BDB8247292D2DCF0093AC9D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3BDB8246292D2DCF0093AC9D /* Preview Assets.xcassets */; }; - 3BDB824F292D2E4B0093AC9D /* RollbarAUL in Frameworks */ = {isa = PBXBuildFile; productRef = 3BDB824E292D2E4B0093AC9D /* RollbarAUL */; }; - 3BDB8251292D2E4B0093AC9D /* RollbarCommon in Frameworks */ = {isa = PBXBuildFile; productRef = 3BDB8250292D2E4B0093AC9D /* RollbarCommon */; }; 3BDB8253292D2E4B0093AC9D /* RollbarNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 3BDB8252292D2E4B0093AC9D /* RollbarNotifier */; }; 3BDB8257292D2E4B0093AC9D /* RollbarSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3BDB8256292D2E4B0093AC9D /* RollbarSwift */; }; /* End PBXBuildFile section */ @@ -33,9 +30,6 @@ files = ( 3BDB8253292D2E4B0093AC9D /* RollbarNotifier in Frameworks */, 3BDB8257292D2E4B0093AC9D /* RollbarSwift in Frameworks */, - 3B3C439029704BDD0026266C /* RollbarKSCrash in Frameworks */, - 3BDB8251292D2E4B0093AC9D /* RollbarCommon in Frameworks */, - 3BDB824F292D2E4B0093AC9D /* RollbarAUL in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -102,11 +96,8 @@ ); name = iosAppSwift; packageProductDependencies = ( - 3BDB824E292D2E4B0093AC9D /* RollbarAUL */, - 3BDB8250292D2E4B0093AC9D /* RollbarCommon */, 3BDB8252292D2E4B0093AC9D /* RollbarNotifier */, 3BDB8256292D2E4B0093AC9D /* RollbarSwift */, - 3B3C438F29704BDD0026266C /* RollbarKSCrash */, ); productName = iosAppSwift; productReference = 3BDB823C292D2DCE0093AC9D /* iosAppSwift.app */; @@ -370,18 +361,6 @@ /* End XCConfigurationList section */ /* Begin XCSwiftPackageProductDependency section */ - 3B3C438F29704BDD0026266C /* RollbarKSCrash */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarKSCrash; - }; - 3BDB824E292D2E4B0093AC9D /* RollbarAUL */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarAUL; - }; - 3BDB8250292D2E4B0093AC9D /* RollbarCommon */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarCommon; - }; 3BDB8252292D2E4B0093AC9D /* RollbarNotifier */ = { isa = XCSwiftPackageProductDependency; productName = RollbarNotifier; diff --git a/Demos/iosAppSwift/iosAppSwift.xcodeproj/xcshareddata/xcschemes/iosAppSwift.xcscheme b/Demos/iosAppSwift/iosAppSwift.xcodeproj/xcshareddata/xcschemes/iosAppSwift.xcscheme index cf323e7d..d66406d2 100644 --- a/Demos/iosAppSwift/iosAppSwift.xcodeproj/xcshareddata/xcschemes/iosAppSwift.xcscheme +++ b/Demos/iosAppSwift/iosAppSwift.xcodeproj/xcshareddata/xcschemes/iosAppSwift.xcscheme @@ -1,6 +1,6 @@ crashCollector = - //nil; - //[[RollbarKSCrashCollector alloc] init]; - [[RollbarPLCrashCollector alloc] init]; - // init Rollbar shared instance: - [Rollbar initWithConfiguration:config crashCollector:crashCollector]; + [Rollbar initWithConfiguration:config]; [Rollbar infoMessage:@"Rollbar is up and running! Enjoy your remote error and log monitoring..."]; } diff --git a/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj index 45333629..2a916a83 100644 --- a/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj +++ b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj @@ -12,8 +12,6 @@ 55098C6925FA93110045C180 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55098C6825FA93110045C180 /* Assets.xcassets */; }; 55098C6C25FA93110045C180 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55098C6B25FA93110045C180 /* Preview Assets.xcassets */; }; 552689F12657381B004D6036 /* RollbarAUL in Frameworks */ = {isa = PBXBuildFile; productRef = 552689F02657381B004D6036 /* RollbarAUL */; }; - 552689F326573831004D6036 /* RollbarPLCrashReporter in Frameworks */ = {isa = PBXBuildFile; productRef = 552689F226573831004D6036 /* RollbarPLCrashReporter */; }; - 5544A01F25FB074300C710A1 /* RollbarCommon in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A01E25FB074300C710A1 /* RollbarCommon */; }; 5544A02125FB074300C710A1 /* RollbarNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02025FB074300C710A1 /* RollbarNotifier */; }; 5544A02325FB074300C710A1 /* RollbarSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02225FB074300C710A1 /* RollbarSwift */; }; /* End PBXBuildFile section */ @@ -33,9 +31,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5544A01F25FB074300C710A1 /* RollbarCommon in Frameworks */, 5544A02125FB074300C710A1 /* RollbarNotifier in Frameworks */, - 552689F326573831004D6036 /* RollbarPLCrashReporter in Frameworks */, 552689F12657381B004D6036 /* RollbarAUL in Frameworks */, 5544A02325FB074300C710A1 /* RollbarSwift in Frameworks */, ); @@ -106,11 +102,9 @@ ); name = macosAppSwift; packageProductDependencies = ( - 5544A01E25FB074300C710A1 /* RollbarCommon */, 5544A02025FB074300C710A1 /* RollbarNotifier */, 5544A02225FB074300C710A1 /* RollbarSwift */, 552689F02657381B004D6036 /* RollbarAUL */, - 552689F226573831004D6036 /* RollbarPLCrashReporter */, ); productName = macosAppSwift; productReference = 55098C6125FA930D0045C180 /* macosAppSwift.app */; @@ -123,7 +117,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1240; - LastUpgradeCheck = 1240; + LastUpgradeCheck = 1420; TargetAttributes = { 55098C6025FA930D0045C180 = { CreatedOnToolsVersion = 12.4; @@ -207,6 +201,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -268,6 +263,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -297,6 +293,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"macosAppSwift/Preview Content\""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = macosAppSwift/Info.plist; @@ -304,7 +301,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 11.0; + MACOSX_DEPLOYMENT_TARGET = 12.0; PRODUCT_BUNDLE_IDENTIFIER = com.rollbar.macosAppSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -320,6 +317,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"macosAppSwift/Preview Content\""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = macosAppSwift/Info.plist; @@ -327,7 +325,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 11.0; + MACOSX_DEPLOYMENT_TARGET = 12.0; PRODUCT_BUNDLE_IDENTIFIER = com.rollbar.macosAppSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -362,14 +360,6 @@ isa = XCSwiftPackageProductDependency; productName = RollbarAUL; }; - 552689F226573831004D6036 /* RollbarPLCrashReporter */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarPLCrashReporter; - }; - 5544A01E25FB074300C710A1 /* RollbarCommon */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarCommon; - }; 5544A02025FB074300C710A1 /* RollbarNotifier */ = { isa = XCSwiftPackageProductDependency; productName = RollbarNotifier; diff --git a/Demos/macosAppSwift/macosAppSwift/ContentView.swift b/Demos/macosAppSwift/macosAppSwift/ContentView.swift index 34ad9c4a..63bf9659 100644 --- a/Demos/macosAppSwift/macosAppSwift/ContentView.swift +++ b/Demos/macosAppSwift/macosAppSwift/ContentView.swift @@ -1,126 +1,134 @@ -// -// ContentView.swift -// macosAppSwift -// -// Created by Andrey Kornich on 2021-03-11. -// - import SwiftUI -import RollbarNotifier import RollbarSwift -import RollbarAUL +import RollbarNotifier + +enum ExampleError: Error { + case + invalidResult, + outOfBounds, + invalidInput +} struct ContentView: View { - + let example = Example(); + var body: some View { - - VStack(content: { - - Text("Hello, world!") - .multilineTextAlignment(.center) - .padding() - - Button("Handle Swift Error") { - self.handleSwiftError() - } - - Button("Handle Obj-C Exception") { - self.handleObjCException() - } - - Button("Handle Obj-C Exception with Rollbar") { - self.handleObjCExceptionWithRollbar() + VStack { + Text("Rollbar Apple SDK Example") + .font(.title) + .padding(.bottom) + + VStack { + Button("Manual Logging Example", action: example.manualLogging) + .tint(.blue) + .buttonStyle(.bordered) + + Button("Divide by zero") { _ = example.divide(by: 0) } + .tint(.blue) + .buttonStyle(.bordered) + + Button("Log invalid JSON", action: example.logInvalidJson) + .tint(.blue) + .buttonStyle(.bordered) + .padding(.bottom) + + Button("Throw an ExampleError") { try! example.throwError() } + .tint(.blue) + .buttonStyle(.bordered) + + Button("Throw an NSException", action: example.throwNSException) + .tint(.blue) + .buttonStyle(.bordered) + .padding(.bottom) + + Button("Assertion Failure", action: example.forceAssertionFailure) + .tint(.blue) + .buttonStyle(.bordered) + + Button("Precondition Failure", action: example.forcePreconditionFailure) + .tint(.blue) + .buttonStyle(.bordered) + + Button("Fatal Error", action: example.forceFatalError) + .tint(.blue) + .buttonStyle(.bordered) } - }) + } + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() } - -func handleSwiftError() { - +} + +struct Example { + let logger = RollbarLogger(configuration: Rollbar.configuration()) + + /// Some different ways to explicitly log an error to Rollbar. + func manualLogging() { + let extraInfo = ["item_1": "value_1", "item_2": "value_2"] + + Rollbar.log(.error, message: "My log message") + + Rollbar.log( + .error, + error: ExampleError.invalidInput, + data: extraInfo, + context: "Some additional information.") + + Rollbar.errorMessage("My error message", data: extraInfo) + + Rollbar.errorError(ExampleError.invalidResult, data: extraInfo) + do { - - try self.generateSwiftError(); - } - catch AppError.problem1 { - - } - catch AppError.problem2 { - + throw ExampleError.outOfBounds + } catch { + Rollbar.errorError(error, data: extraInfo) } - catch { - - print("Unexpected error: \(error).") - } - } - - func generateSwiftError() throws { - - throw AppError.limitExceeded(limit: 5) } - - func handleObjCException() { - - self.generateObjCException(); + + /// A hard crash is captured by the crash reporter. The next time + /// the application is started, the data is sent to Rollbar. + func forceFatalError() { + fatalError("Force a crash") } - - func generateObjCException() { - - RollbarTryCatch.throw("NSException from Obj-C...") + + func forcePreconditionFailure() { + preconditionFailure("Precondition failed") } - func handleObjCExceptionWithRollbar() { - - let exceptionGuard = createGuard(); - - var success = true; - - success = exceptionGuard.tryExecute { - - self.generateObjCException(); - } + func forceAssertionFailure() { + assertionFailure("Assertion failed") + } - print("Guarded execution succeeded: \(success).") + func divide(by y: Int) -> Int { + 1 / y } - - func createGuard() -> RollbarExceptionGuard { - - let config = RollbarConfig.mutableConfig( - withAccessToken: RollbarDemoSettings.payloadsPostAccessToken, - environment: RollbarDemoSettings.environment) - - // AUL capture setup: -// config.developerOptions.transmit = true; -// config.telemetry.enabled = true; -// config.telemetry.captureLog = true; -// -// Rollbar.initWithConfiguration(config); -// RollbarAulStoreMonitor.sharedInstance().configureRollbarLogger(Rollbar.currentLogger()); -// let aulOptions = RollbarAulStoreMonitorOptions(); -// aulOptions.addAulSubsystem("DataAccessLayer"); -// aulOptions.addAulSubsystem("Model"); -// aulOptions.addAulCategory("CompanyOrg"); -// RollbarAulStoreMonitor.sharedInstance().configure(with: aulOptions); -// -// RollbarAulStoreMonitor.sharedInstance().start(); - - let logger = RollbarLogger(configuration: config); - - let exceptionGuard = RollbarExceptionGuard(logger: logger); - - return exceptionGuard; + + func throwError() throws { + throw ExampleError.outOfBounds } -} -struct ContentView_Previews: PreviewProvider { - - static var previews: some View { - - ContentView() + func throwNSException() { + RollbarExceptionGuard(logger: logger).tryExecute { + RollbarTryCatch.throw("NSException from ObjC") + } } -} -// Declare our error type -enum AppError: Error { - case problem1 - case problem2 - case limitExceeded(limit: Int) + func logInvalidJson() { + Rollbar.log( + .warning, + message: "Logging with extras and context", + data: [ + "fingerprint": "targeted-mistake-recycling-incorrect-range", + "bestSolutionTokens": [51241, 42421, 32142], + "guessTokens": [22414, 89389], + // This is a (Int, Int), which can't be turned into Json + "detectedRangeStart": (1, 10), + ], + context: "Rollbar Example Logging Invalid Json") + } } diff --git a/Demos/tvosAppObjC/tvosAppObjC.xcodeproj/project.pbxproj b/Demos/tvosAppObjC/tvosAppObjC.xcodeproj/project.pbxproj index 344c1591..4dd77077 100644 --- a/Demos/tvosAppObjC/tvosAppObjC.xcodeproj/project.pbxproj +++ b/Demos/tvosAppObjC/tvosAppObjC.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 554E672A282B44F600908A64 /* RollbarKSCrash in Frameworks */ = {isa = PBXBuildFile; productRef = 554E6729282B44F600908A64 /* RollbarKSCrash */; }; - 554E672C282B44F600908A64 /* RollbarPLCrashReporter in Frameworks */ = {isa = PBXBuildFile; productRef = 554E672B282B44F600908A64 /* RollbarPLCrashReporter */; }; 55889E292818B83B002E0228 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 55889E282818B83B002E0228 /* AppDelegate.m */; }; 55889E2C2818B83B002E0228 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55889E2B2818B83B002E0228 /* ViewController.m */; }; 55889E2F2818B83B002E0228 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55889E2D2818B83B002E0228 /* Main.storyboard */; }; @@ -36,8 +34,6 @@ buildActionMask = 2147483647; files = ( 55DD35832818C3150061AC50 /* RollbarNotifier in Frameworks */, - 554E672A282B44F600908A64 /* RollbarKSCrash in Frameworks */, - 554E672C282B44F600908A64 /* RollbarPLCrashReporter in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -101,8 +97,6 @@ name = tvosAppObjC; packageProductDependencies = ( 55DD35822818C3150061AC50 /* RollbarNotifier */, - 554E6729282B44F600908A64 /* RollbarKSCrash */, - 554E672B282B44F600908A64 /* RollbarPLCrashReporter */, ); productName = tvosAppObjC; productReference = 55889E242818B83B002E0228 /* tvosAppObjC.app */; @@ -368,14 +362,6 @@ /* End XCConfigurationList section */ /* Begin XCSwiftPackageProductDependency section */ - 554E6729282B44F600908A64 /* RollbarKSCrash */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarKSCrash; - }; - 554E672B282B44F600908A64 /* RollbarPLCrashReporter */ = { - isa = XCSwiftPackageProductDependency; - productName = RollbarPLCrashReporter; - }; 55DD35822818C3150061AC50 /* RollbarNotifier */ = { isa = XCSwiftPackageProductDependency; productName = RollbarNotifier; diff --git a/Demos/tvosAppObjC/tvosAppObjC/AppDelegate.m b/Demos/tvosAppObjC/tvosAppObjC/AppDelegate.m index f11aacd6..c19155aa 100644 --- a/Demos/tvosAppObjC/tvosAppObjC/AppDelegate.m +++ b/Demos/tvosAppObjC/tvosAppObjC/AppDelegate.m @@ -8,8 +8,6 @@ #import "AppDelegate.h" @import RollbarNotifier; -@import RollbarKSCrash; -@import RollbarPLCrashReporter; @interface AppDelegate () @@ -90,10 +88,7 @@ - (void)initRollbar { //config.customData = @{ @"someKey": @"someValue", }; // init Rollbar shared instance: - //id crashCollector = [[RollbarKSCrashCollector alloc] init]; - id crashCollector = [[RollbarPLCrashCollector alloc] init]; - - [Rollbar initWithConfiguration:config crashCollector:crashCollector]; + [Rollbar initWithConfiguration:config]; [Rollbar infoMessage:@"Rollbar is up and running! Enjoy your remote error and log monitoring..."]; } diff --git a/Demos/watchosAppObjC/watchosAppObjC WatchKit Extension/ExtensionDelegate.m b/Demos/watchosAppObjC/watchosAppObjC WatchKit Extension/ExtensionDelegate.m index c2b1664f..7f82d805 100644 --- a/Demos/watchosAppObjC/watchosAppObjC WatchKit Extension/ExtensionDelegate.m +++ b/Demos/watchosAppObjC/watchosAppObjC WatchKit Extension/ExtensionDelegate.m @@ -108,7 +108,7 @@ - (void)initRollbar { // init Rollbar shared instance: - [Rollbar initWithConfiguration:config crashCollector:nil]; + [Rollbar initWithConfiguration:config]; [Rollbar infoMessage:@"Rollbar is up and running! Enjoy your remote error and log monitoring..."]; } diff --git a/Package.resolved b/Package.resolved index 0e3de8d9..def0ed8d 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,43 +1,32 @@ { - "object": { - "pins": [ - { - "package": "CocoaLumberjack", - "repositoryURL": "https://github.com/CocoaLumberjack/CocoaLumberjack.git", - "state": { - "branch": null, - "revision": "0188d31089b5881a269e01777be74c7316924346", - "version": "3.8.0" - } - }, - { - "package": "KSCrash", - "repositoryURL": "https://github.com/kstenerud/KSCrash.git", - "state": { - "branch": null, - "revision": "f45a917d93928b32626f3268239c58a6cdd852bb", - "version": "1.15.25" - } - }, - { - "package": "PLCrashReporter", - "repositoryURL": "https://github.com/microsoft/plcrashreporter.git", - "state": { - "branch": null, - "revision": "b1a342da19ed9b3af61ea2efa7656c2af30aeb7c", - "version": "1.11.0" - } - }, - { - "package": "swift-log", - "repositoryURL": "https://github.com/apple/swift-log.git", - "state": { - "branch": null, - "revision": "6fe203dc33195667ce1759bf0182975e4653ba1c", - "version": "1.4.4" - } + "pins" : [ + { + "identity" : "cocoalumberjack", + "kind" : "remoteSourceControl", + "location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git", + "state" : { + "revision" : "0188d31089b5881a269e01777be74c7316924346", + "version" : "3.8.0" } - ] - }, - "version": 1 + }, + { + "identity" : "kscrash", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kstenerud/KSCrash.git", + "state" : { + "revision" : "c49092e96815ea6cb348862cd2a8c03bb8bd63f2", + "version" : "1.15.26" + } + }, + { + "identity" : "swift-log", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-log.git", + "state" : { + "revision" : "6fe203dc33195667ce1759bf0182975e4653ba1c", + "version" : "1.4.4" + } + } + ], + "version" : 2 } diff --git a/Package.swift b/Package.swift index 201c8e1e..a2029103 100644 --- a/Package.swift +++ b/Package.swift @@ -1,124 +1,67 @@ -// swift-tools-version:5.5 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version:5.7.1 import PackageDescription let package = Package( name: "RollbarSDK", platforms: [ - // Oldest targeted platform versions that are supported by this product. .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v7), ], products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. - .library( - name: "RollbarCommon", - targets: ["RollbarCommon"]), - .library( - name: "RollbarDeploys", - targets: ["RollbarDeploys"]), - .library( - name: "RollbarNotifier", - targets: ["RollbarNotifier"]), - .library( - name: "RollbarKSCrash", - targets: ["RollbarKSCrash"]), - .library( - name: "RollbarPLCrashReporter", - targets: ["RollbarPLCrashReporter"]), - .library( - name: "RollbarAUL", - targets: ["RollbarAUL"]), - .library( - name: "RollbarSwift", - targets: ["RollbarSwift"]), - .library( - name: "RollbarCocoaLumberjack", - targets: ["RollbarCocoaLumberjack"]), + .library(name: "RollbarCommon", targets: ["RollbarCommon"]), + .library(name: "RollbarNotifier", targets: ["RollbarNotifier"]), + .library(name: "RollbarSwift", targets: ["RollbarSwift"]), + .library(name: "RollbarDeploys", targets: ["RollbarDeploys"]), + .library(name: "RollbarAUL", targets: ["RollbarAUL"]), + .library(name: "RollbarCocoaLumberjack", targets: ["RollbarCocoaLumberjack"]), ], dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), - .package(name:"KSCrash", - url: "https://github.com/kstenerud/KSCrash.git", - from: "1.15.25" //Package.Dependency.Requirement.branch("master") - ), - .package(name:"PLCrashReporter", - url: "https://github.com/microsoft/plcrashreporter.git", - from: "1.10.1" //Package.Dependency.Requirement.branch("master") - ), - .package(name:"CocoaLumberjack", - url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", - from: "3.7.4" //Package.Dependency.Requirement.branch("master") - ), + .package(url: "https://github.com/kstenerud/KSCrash.git", from: "1.15.26"), + .package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", from: "3.7.4"), ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "RollbarCommon", - dependencies: [ - ], path: "RollbarCommon/Sources/RollbarCommon", publicHeadersPath: "include", cSettings: [ .headerSearchPath("RollbarCommon/Sources/RollbarCommon/**"), - ] - ), - + ]), .target( - name: "RollbarDeploys", + name: "RollbarNotifier", dependencies: [ "RollbarCommon", + "KSCrash", ], - path: "RollbarDeploys/Sources/RollbarDeploys", + path: "RollbarNotifier/Sources/RollbarNotifier", publicHeadersPath: "include", cSettings: [ - .headerSearchPath("RollbarDeploys/Sources/RollbarDeploys/**"), - ] - ), - - .target( - name: "RollbarNotifier", - dependencies: [ - "RollbarCommon", - ], - path: "RollbarNotifier/Sources/RollbarNotifier", - publicHeadersPath: "include", - cSettings: [ - .headerSearchPath("RollbarNotifier/Sources/RollbarNotifier/**"), - ] - ), - + .headerSearchPath("RollbarNotifier/Sources/RollbarNotifier/**"), + ]), .target( - name: "RollbarKSCrash", + name: "RollbarSwift", dependencies: [ "RollbarCommon", - "KSCrash", + "RollbarNotifier", ], - path: "RollbarKSCrash/Sources/RollbarKSCrash", + path: "RollbarSwift/Sources/RollbarSwift", publicHeadersPath: "include", cSettings: [ - .headerSearchPath("RollbarKSCrash/Sources/RollbarKSCrash/**"), - ] - ), - + .headerSearchPath("RollbarSwift/Sources/RollbarSwift/**"), + ]), .target( - name: "RollbarPLCrashReporter", + name: "RollbarDeploys", dependencies: [ "RollbarCommon", - .product(name: "CrashReporter", package: "PLCrashReporter"), ], - path: "RollbarPLCrashReporter/Sources/RollbarPLCrashReporter", + path: "RollbarDeploys/Sources/RollbarDeploys", publicHeadersPath: "include", cSettings: [ - .headerSearchPath("RollbarPLCrashReporter/Sources/RollbarPLCrashReporter/**"), - ] - ), - + .headerSearchPath("RollbarDeploys/Sources/RollbarDeploys/**"), + ]), .target( name: "RollbarAUL", dependencies: [ @@ -129,22 +72,7 @@ let package = Package( publicHeadersPath: "include", cSettings: [ .headerSearchPath("RollbarAUL/Sources/RollbarAUL/**"), - ] - ), - - .target( - name: "RollbarSwift", - dependencies: [ - "RollbarCommon", - "RollbarNotifier", - ], - path: "RollbarSwift/Sources/RollbarSwift", - publicHeadersPath: "include", - cSettings: [ - .headerSearchPath("RollbarSwift/Sources/RollbarSwift/**"), - ] - ), - + ]), .target( name: "RollbarCocoaLumberjack", dependencies: [ @@ -158,11 +86,8 @@ let package = Package( .headerSearchPath("RollbarCocoaLumberjack/Sources/RollbarCocoaLumberjack/**"), ] ), - ], swiftLanguageVersions: [ - SwiftVersion.v4, - SwiftVersion.v4_2, SwiftVersion.v5, ] ) diff --git a/RollbarAUL/.swiftpm/xcode/xcshareddata/xcschemes/RollbarAUL.xcscheme b/RollbarAUL/.swiftpm/xcode/xcshareddata/xcschemes/RollbarAUL.xcscheme index df2a13b7..136ebda4 100644 --- a/RollbarAUL/.swiftpm/xcode/xcshareddata/xcschemes/RollbarAUL.xcscheme +++ b/RollbarAUL/.swiftpm/xcode/xcshareddata/xcschemes/RollbarAUL.xcscheme @@ -1,6 +1,6 @@ )observer { - - if (self = [super init]) { - self->_observer = observer; - } - return self; -} - -- (void)collectCrashReportsWithObserver:(id)observer { - - [NSException raise:NSInternalInconsistencyException - format:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]; -} - -- (void)collectCrashReports { - if (nil == self->_observer) { - RollbarSdkLog(@"RollbarCrashCollectorBase was not initialized with a valid observer."); - } - [self collectCrashReportsWithObserver:self->_observer]; -} - -@end diff --git a/RollbarCommon/Sources/RollbarCommon/include/RollbarCrashCollectorBase.h b/RollbarCommon/Sources/RollbarCommon/include/RollbarCrashCollectorBase.h deleted file mode 100644 index aac64e03..00000000 --- a/RollbarCommon/Sources/RollbarCommon/include/RollbarCrashCollectorBase.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef RollbarCrashCollectorBase_h -#define RollbarCrashCollectorBase_h - -#import "RollbarCrashCollectorProtocol.h" - -@import Foundation; - -@protocol RollbarCrashCollectorObserver; - -NS_ASSUME_NONNULL_BEGIN - -/// Abstract implementation of the RollbarCrashCollector protocol. -@interface RollbarCrashCollectorBase : NSObject { - @private - id _observer; -} - -/// Designated initializer. -/// @param observer a crash collector observer. -- (instancetype)initWithObserver:(nullable id)observer -NS_DESIGNATED_INITIALIZER; - -/// Initializer. -- (instancetype)init; - -@end - -NS_ASSUME_NONNULL_END - -#endif /* RollbarCrashCollectorBase_h */ diff --git a/RollbarCommon/Sources/RollbarCommon/include/RollbarCrashCollectorProtocol.h b/RollbarCommon/Sources/RollbarCommon/include/RollbarCrashCollectorProtocol.h deleted file mode 100644 index 4bb5c92b..00000000 --- a/RollbarCommon/Sources/RollbarCommon/include/RollbarCrashCollectorProtocol.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef RollbarCrashCollectorProtocol_h -#define RollbarCrashCollectorProtocol_h - -@import Foundation; - -@class RollbarCrashReportData; - -/// Crash collector observer protocol. -@protocol RollbarCrashCollectorObserver - -@required -/// Collback invoked when discovered crash reports are loaded. -/// @param crashReports discovered crash reports. --(void)onCrashReportsCollectionCompletion:(NSArray *)crashReports; - -@optional -//... - -@end - -/// Crash collector protocol. -@protocol RollbarCrashCollector - -@required -/// Triggers a collection of crash reports (if any). -/// @param observer an observer to notify after the collection is done. --(void)collectCrashReportsWithObserver:(id)observer; - -@optional -/// Triggers a collection of crash reports (if any). --(void)collectCrashReports; - -@end - -#endif /* RollbarCrashCollectorProtocol_h */ diff --git a/RollbarDeploys/.swiftpm/xcode/xcshareddata/xcschemes/RollbarDeploys.xcscheme b/RollbarDeploys/.swiftpm/xcode/xcshareddata/xcschemes/RollbarDeploys.xcscheme index 8c0c34e1..bc070070 100644 --- a/RollbarDeploys/.swiftpm/xcode/xcshareddata/xcschemes/RollbarDeploys.xcscheme +++ b/RollbarDeploys/.swiftpm/xcode/xcshareddata/xcschemes/RollbarDeploys.xcscheme @@ -1,6 +1,6 @@ "MIT", :file => "LICENSE" } - # s.license = "MIT (example)" - s.documentation_url = "https://docs.rollbar.com/docs/apple" - s.authors = { "Andrey Kornich (Wide Spectrum Computing LLC)" => "akornich@gmail.com", - "Rollbar" => "support@rollbar.com" } - # s.author = { "Andrey Kornich" => "akornich@gmail.com" } - # Or just: s.author = "Andrey Kornich" - s.social_media_url = "http://twitter.com/rollbar" - s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", - :tag => "#{s.version}" - } - s.resource = "rollbar-logo.png" - # s.resources = "Resources/*.png" - - # When using multiple platforms: - s.osx.deployment_target = "10.15" - s.ios.deployment_target = "13.0" - s.tvos.deployment_target = "13.0" - s.watchos.deployment_target = "7.0" - # Any platform, if omitted: - # s.platform = :ios - # s.platform = :ios, "5.0" - - s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" - s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" - s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" - # s.exclude_files = "Classes/Exclude" - # s.preserve_paths = "FilesToSave", "MoreFilesToSave" - - s.framework = "Foundation" - s.dependency "RollbarCommon", "~> #{s.version}" - s.dependency "KSCrash", "~> 1.15.25" - # s.frameworks = "SomeFramework", "AnotherFramework" - # s.library = "iconv" - # s.libraries = "iconv", "xml2" - # s.dependency "JSONKit", "~> 1.4" - - s.requires_arc = true - # s.xcconfig = { - # "USE_HEADERMAP" => "NO", - # "HEADER_SEARCH_PATHS" => "$(PODS_ROOT)/Sources/#{s.name}/**" - # } - - # s.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } - # s.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } - - # s.tvos.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } - # s.tvos.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } - -end diff --git a/RollbarKSCrash/.gitignore b/RollbarKSCrash/.gitignore deleted file mode 100644 index 95c43209..00000000 --- a/RollbarKSCrash/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.DS_Store -/.build -/Packages -/*.xcodeproj -xcuserdata/ diff --git a/RollbarKSCrash/.swiftpm/xcode/xcshareddata/xcschemes/RollbarKSCrash.xcscheme b/RollbarKSCrash/.swiftpm/xcode/xcshareddata/xcschemes/RollbarKSCrash.xcscheme deleted file mode 100644 index 2957f374..00000000 --- a/RollbarKSCrash/.swiftpm/xcode/xcshareddata/xcschemes/RollbarKSCrash.xcscheme +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/RollbarKSCrash/.swiftpm/xcode/xcshareddata/xcschemes/RollbarKSCrashTests-ObjC.xcscheme b/RollbarKSCrash/.swiftpm/xcode/xcshareddata/xcschemes/RollbarKSCrashTests-ObjC.xcscheme deleted file mode 100644 index 4525ead5..00000000 --- a/RollbarKSCrash/.swiftpm/xcode/xcshareddata/xcschemes/RollbarKSCrashTests-ObjC.xcscheme +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/RollbarKSCrash/Package.swift b/RollbarKSCrash/Package.swift deleted file mode 100644 index 33a8fde9..00000000 --- a/RollbarKSCrash/Package.swift +++ /dev/null @@ -1,51 +0,0 @@ -// swift-tools-version:5.7.1 - -import PackageDescription - -let package = Package( - name: "RollbarKSCrash", - platforms: [ - .macOS(.v10_15), - .iOS(.v13), - .tvOS(.v13), - .watchOS(.v7), - ], - products: [ - .library(name: "RollbarKSCrash", targets: ["RollbarKSCrash"]), - ], - dependencies: [ - .package(name:"RollbarCommon", path: "../RollbarCommon"), - .package(name: "UnitTesting", path: "../UnitTesting"), - .package(url: "https://github.com/kstenerud/KSCrash.git", from: "1.15.26"), - ], - targets: [ - .target( - name: "RollbarKSCrash", - dependencies: [ - "RollbarCommon", - "KSCrash" - ], - publicHeadersPath: "include", - cSettings: [ - .headerSearchPath("Sources/RollbarKSCrash/**"), - ] - ), - .testTarget( - name: "RollbarKSCrashTests", - dependencies: [ - "UnitTesting", - "RollbarKSCrash", - ] - ), - .testTarget( - name: "RollbarKSCrashTests-ObjC", - dependencies: ["RollbarKSCrash"], - cSettings: [ - .headerSearchPath("Tests/RollbarKSCrashTests-ObjC/**"), - ] - ), - ], - swiftLanguageVersions: [ - SwiftVersion.v5, - ] -) diff --git a/RollbarKSCrash/README.md b/RollbarKSCrash/README.md deleted file mode 100644 index 4ae10182..00000000 --- a/RollbarKSCrash/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# RollbarKSCrash - -This is an SDK module implements a RollbarCrashCollector based on the [KSCrash reporter](https://github.com/kstenerud/KSCrash). - diff --git a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashCollector.m b/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashCollector.m deleted file mode 100644 index 2ecfc127..00000000 --- a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashCollector.m +++ /dev/null @@ -1,31 +0,0 @@ -#import "RollbarKSCrashCollector.h" -#import "RollbarCrashReportData.h" -#import "RollbarKSCrashInstallation.h" -#import "RollbarKSCrashReportSink.h" - -@implementation RollbarKSCrashCollector - -+ (void)initialize { - if (self == [RollbarKSCrashCollector class]) { - [[RollbarKSCrashInstallation sharedInstance] install]; - } -} - -- (void)collectCrashReportsWithObserver:(NSObject *)observer { - NSMutableArray *crashReports = [[NSMutableArray alloc] init]; - - [[RollbarKSCrashInstallation sharedInstance] sendAllReportsWithCompletion:^(NSArray *filteredReports, BOOL completed, NSError *error) { - if (error) { - RollbarSdkLog(@"Could not enable crash reporter: %@", [error localizedDescription]); - } else if (completed) { - for (NSString *crashReport in filteredReports) { - RollbarCrashReportData *crashReportData = [[RollbarCrashReportData alloc] initWithCrashReport:crashReport]; - [crashReports addObject:crashReportData]; - } - } - }]; - - [observer onCrashReportsCollectionCompletion:crashReports]; -} - -@end diff --git a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashInstallation.h b/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashInstallation.h deleted file mode 100644 index d2555b89..00000000 --- a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashInstallation.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// RollbarKSCrashInstallation.h -// -// -// Created by Andrey Kornich on 2020-10-28. -// - -#ifndef RollbarKSCrashInstallation_h -#define RollbarKSCrashInstallation_h - -@import KSCrash_Installations; - -NS_ASSUME_NONNULL_BEGIN - -/// Rollbar KSCrash installation helper -@interface RollbarKSCrashInstallation : KSCrashInstallation - -/// The shared instance of this helper. -+ (instancetype)sharedInstance; - -@end - -NS_ASSUME_NONNULL_END - -#endif //RollbarKSCrashInstallation_h diff --git a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashReportSink.h b/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashReportSink.h deleted file mode 100644 index 9b0aad6d..00000000 --- a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashReportSink.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef RollbarKSCrashReportSink_h -#define RollbarKSCrashReportSink_h - -@import Foundation; -@import KSCrash_Reporting_Sinks; - -NS_ASSUME_NONNULL_BEGIN - -/// Rollbar KSCrashReport sink -@interface RollbarKSCrashReportSink : NSObject - -/// Gets the default filter set -- (id)defaultFilterSet; - -@end - -NS_ASSUME_NONNULL_END - -#endif //RollbarKSCrashReportSink_h diff --git a/RollbarKSCrash/Sources/RollbarKSCrash/include/RollbarKSCrashCollector.h b/RollbarKSCrash/Sources/RollbarKSCrash/include/RollbarKSCrashCollector.h deleted file mode 100644 index 110030cc..00000000 --- a/RollbarKSCrash/Sources/RollbarKSCrash/include/RollbarKSCrashCollector.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef RollbarKSCrashCollector_h -#define RollbarKSCrashCollector_h - -@import Foundation; -@import RollbarCommon; - -NS_ASSUME_NONNULL_BEGIN - -/// Rollbar KSCrash reports collector -@interface RollbarKSCrashCollector : RollbarCrashCollectorBase - -@end - -NS_ASSUME_NONNULL_END - -#endif //RollbarKSCrashCollector_h diff --git a/RollbarKSCrash/Sources/RollbarKSCrash/include/module.modulemap b/RollbarKSCrash/Sources/RollbarKSCrash/include/module.modulemap deleted file mode 100644 index 5ebfc1dd..00000000 --- a/RollbarKSCrash/Sources/RollbarKSCrash/include/module.modulemap +++ /dev/null @@ -1,8 +0,0 @@ -module RollbarKSCrash { - umbrella "." - - export * - module * { export * } - - requires objc -} diff --git a/RollbarKSCrash/Tests/LinuxMain.swift b/RollbarKSCrash/Tests/LinuxMain.swift deleted file mode 100644 index 84a4ea44..00000000 --- a/RollbarKSCrash/Tests/LinuxMain.swift +++ /dev/null @@ -1,7 +0,0 @@ -import XCTest - -import RollbarKSCrashTests - -var tests = [XCTestCaseEntry]() -tests += RollbarKSCrashTests.allTests() -XCTMain(tests) diff --git a/RollbarKSCrash/Tests/RollbarKSCrashTests-ObjC/RollbarKSCrashTests.m b/RollbarKSCrash/Tests/RollbarKSCrashTests-ObjC/RollbarKSCrashTests.m deleted file mode 100644 index 1b6bb093..00000000 --- a/RollbarKSCrash/Tests/RollbarKSCrashTests-ObjC/RollbarKSCrashTests.m +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2018 Rollbar, Inc. All rights reserved. - -#import - -@import RollbarKSCrash; - -@interface RollbarKSCrashTests : XCTestCase -@end - -@implementation RollbarKSCrashTests - -- (void)testBasics { -} - -@end - diff --git a/RollbarKSCrash/Tests/RollbarKSCrashTests/RollbarKSCrashTests.swift b/RollbarKSCrash/Tests/RollbarKSCrashTests/RollbarKSCrashTests.swift deleted file mode 100644 index a3887dd8..00000000 --- a/RollbarKSCrash/Tests/RollbarKSCrashTests/RollbarKSCrashTests.swift +++ /dev/null @@ -1,15 +0,0 @@ -import XCTest -@testable import RollbarKSCrash - -final class RollbarKSCrashTests: XCTestCase { - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct - // results. - //XCTAssertEqual(RollbarKSCrash().text, "Hello, World!") - } - - static var allTests = [ - ("testExample", testExample), - ] -} diff --git a/RollbarKSCrash/Tests/RollbarKSCrashTests/XCTestManifests.swift b/RollbarKSCrash/Tests/RollbarKSCrashTests/XCTestManifests.swift deleted file mode 100644 index b0d7de0b..00000000 --- a/RollbarKSCrash/Tests/RollbarKSCrashTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !canImport(ObjectiveC) -public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(RollbarKSCrashTests.allTests), - ] -} -#endif diff --git a/RollbarNotifier.podspec b/RollbarNotifier.podspec index 4cc9dd05..10b7ef14 100644 --- a/RollbarNotifier.podspec +++ b/RollbarNotifier.podspec @@ -1,12 +1,4 @@ -# -# Be sure to run `pod spec lint RollbarSDK.podspec' to ensure this is a valid spec. -# -# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html -# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ -# - Pod::Spec.new do |s| - s.version = "2.4.0" s.name = "RollbarNotifier" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." @@ -17,53 +9,28 @@ Pod::Spec.new do |s| Search, sort, and prioritize via the Rollbar dashboard. DESC s.homepage = "https://rollbar.com" - # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" s.license = { :type => "MIT", :file => "LICENSE" } - # s.license = "MIT (example)" + s.resource = "rollbar-logo.png" + s.authors = { "Andrey Kornich (Wide Spectrum Computing LLC)" => "akornich@gmail.com", + "Rollbar" => "support@rollbar.com" } + s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", + :tag => "#{s.version}" } s.documentation_url = "https://docs.rollbar.com/docs/apple" - s.authors = { "Andrey Kornich (Wide Spectrum Computing LLC)" => "akornich@gmail.com", - "Rollbar" => "support@rollbar.com" } - # s.author = { "Andrey Kornich" => "akornich@gmail.com" } - # Or just: s.author = "Andrey Kornich" - s.social_media_url = "http://twitter.com/rollbar" - s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", - :tag => "#{s.version}" - } - s.resource = "rollbar-logo.png" - # s.resources = "Resources/*.png" + s.social_media_url = "http://twitter.com/rollbar" # When using multiple platforms: s.osx.deployment_target = "10.15" s.ios.deployment_target = "13.0" s.tvos.deployment_target = "13.0" s.watchos.deployment_target = "7.0" - # Any platform, if omitted: - # s.platform = :ios - # s.platform = :ios, "5.0" s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" - # s.exclude_files = "Classes/Exclude" - # s.preserve_paths = "FilesToSave", "MoreFilesToSave" s.framework = "Foundation" s.dependency "RollbarCommon", "~> #{s.version}" - # s.frameworks = "SomeFramework", "AnotherFramework" - # s.library = "iconv" - # s.libraries = "iconv", "xml2" - # s.dependency "JSONKit", "~> 1.4" + s.dependency "KSCrash", "~> 1.15.26" s.requires_arc = true - # s.xcconfig = { - # "USE_HEADERMAP" => "NO", - # "HEADER_SEARCH_PATHS" => "$(PODS_ROOT)/Sources/#{s.name}/**" - # } - - # s.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } - # s.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } - - # s.tvos.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } - # s.tvos.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } - end diff --git a/RollbarNotifier/.swiftpm/xcode/xcshareddata/xcschemes/RollbarNotifier.xcscheme b/RollbarNotifier/.swiftpm/xcode/xcshareddata/xcschemes/RollbarNotifier.xcscheme index 9b970faf..9e298c86 100644 --- a/RollbarNotifier/.swiftpm/xcode/xcshareddata/xcschemes/RollbarNotifier.xcscheme +++ b/RollbarNotifier/.swiftpm/xcode/xcshareddata/xcschemes/RollbarNotifier.xcscheme @@ -1,6 +1,6 @@ )crashCollector { - - [Rollbar initWithAccessToken:accessToken - configuration:nil - crashCollector:crashCollector]; -} - -+ (void)initWithConfiguration:(RollbarConfig *)configuration - crashCollector:(nullable id)crashCollector { - - [Rollbar initWithAccessToken:nil - configuration:configuration - crashCollector:crashCollector]; -} - -+ (void)initWithAccessToken:(nullable NSString *)accessToken - configuration:(nullable RollbarConfig *)configuration - crashCollector:(nullable id)crashCollector { - - RollbarMutableConfig *config = configuration ? [configuration mutableCopy] : [RollbarMutableConfig new]; - if (accessToken && accessToken.length > 0) { - - config.destination.accessToken = accessToken; - } ++ (void)initWithConfiguration:(nonnull RollbarConfig *)configuration { - [[RollbarInfrastructure sharedInstance] configureWith:config - andCrashCollector:crashCollector]; + [[RollbarInfrastructure sharedInstance] configureWith:[configuration mutableCopy]]; } + (RollbarConfig *)configuration { - return [RollbarInfrastructure sharedInstance].configuration; + return [[RollbarInfrastructure sharedInstance] configuration]; } + (void)updateWithConfiguration:(RollbarConfig *)configuration { - [[RollbarInfrastructure sharedInstance] configureWith:configuration - andCrashCollector:nil]; + [[RollbarInfrastructure sharedInstance] configureWith:configuration]; } #pragma mark - Logging methods + (void)logCrashReport:(NSString *)crashReport { - [[RollbarInfrastructure sharedInstance].logger logCrashReport:crashReport]; + [[[RollbarInfrastructure sharedInstance] logger] logCrashReport:crashReport]; } + (void)log:(RollbarLevel)level diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h new file mode 100644 index 00000000..2132219c --- /dev/null +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h @@ -0,0 +1,20 @@ +#ifndef RollbarCrashCollector_h +#define RollbarCrashCollector_h + +@import Foundation; +@import RollbarCommon; + +NS_ASSUME_NONNULL_BEGIN + +/// Rollbar KSCrash reports collector +@interface RollbarCrashCollector: NSObject + +@property (nonatomic, readonly) NSUInteger totalProcessedReports; + +- (void)collectCrashReports; + +@end + +NS_ASSUME_NONNULL_END + +#endif //RollbarCrashCollector_h diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m new file mode 100644 index 00000000..1d3a90f9 --- /dev/null +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m @@ -0,0 +1,41 @@ +#import "Rollbar.h" +#import "RollbarCrashCollector.h" +#import "RollbarCrashInstallation.h" +#import "RollbarCrashReportData.h" +#import "RollbarCrashReportSink.h" + +@implementation RollbarCrashCollector + ++ (void)initialize { + if (self == [RollbarCrashCollector class]) { + [[RollbarCrashInstallation sharedInstance] install]; + } +} + +- (void)collectCrashReports { + NSMutableArray *crashReports = [[NSMutableArray alloc] init]; + + [[RollbarCrashInstallation sharedInstance] sendAllReportsWithCompletion:^(NSArray *filteredReports, BOOL completed, NSError *error) { + if (error) { + RollbarSdkLog(@"Could not enable crash reporter: %@", [error localizedDescription]); + } else if (completed) { + for (NSString *crashReport in filteredReports) { + RollbarCrashReportData *crashReportData = [[RollbarCrashReportData alloc] initWithCrashReport:crashReport]; + [crashReports addObject:crashReportData]; + } + } + }]; + + self->_totalProcessedReports += crashReports.count; + + for (RollbarCrashReportData *crashRecord in crashReports) { + [Rollbar logCrashReport:crashRecord.crashReport]; + + // Let's sleep this thread for a few seconds to give the items processing thread a chance + // to send the payload logged above so that we can handle cases when the SDK is initialized + // right/shortly before a persistent application crash (that we have no control over) if any: + [NSThread sleepForTimeInterval:5.0f]; // [sec] + } +} + +@end diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashInstallation.h b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashInstallation.h new file mode 100644 index 00000000..9395976e --- /dev/null +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashInstallation.h @@ -0,0 +1,18 @@ +#ifndef RollbarCrashInstallation_h +#define RollbarCrashInstallation_h + +@import KSCrash_Installations; + +NS_ASSUME_NONNULL_BEGIN + +/// Rollbar Crash installation helper +@interface RollbarCrashInstallation : KSCrashInstallation + +/// The shared instance of this helper. ++ (instancetype)sharedInstance; + +@end + +NS_ASSUME_NONNULL_END + +#endif //RollbarCrashInstallation_h diff --git a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashInstallation.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashInstallation.m similarity index 63% rename from RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashInstallation.m rename to RollbarNotifier/Sources/RollbarNotifier/RollbarCrashInstallation.m index 8c501127..bcb81123 100644 --- a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashInstallation.m +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashInstallation.m @@ -1,14 +1,14 @@ -#import "RollbarKSCrashInstallation.h" -#import "RollbarKSCrashReportSink.h" +#import "RollbarCrashInstallation.h" +#import "RollbarCrashReportSink.h" -@implementation RollbarKSCrashInstallation +@implementation RollbarCrashInstallation + (instancetype)sharedInstance { - static RollbarKSCrashInstallation *sharedInstance = nil; + static RollbarCrashInstallation *sharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - sharedInstance = [[RollbarKSCrashInstallation alloc] init]; + sharedInstance = [[RollbarCrashInstallation alloc] init]; }); return sharedInstance; @@ -19,7 +19,7 @@ - (id)init { } - (id)sink { - return [[[RollbarKSCrashReportSink alloc] init] defaultFilterSet]; + return [[[RollbarCrashReportSink alloc] init] defaultFilterSet]; } - (void)sendAllReportsWithCompletion:(KSCrashReportFilterCompletion)onCompletion { diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashProcessor.h b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashProcessor.h deleted file mode 100644 index 68583c58..00000000 --- a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashProcessor.h +++ /dev/null @@ -1,13 +0,0 @@ -@import Foundation; -@import RollbarCommon; - -NS_ASSUME_NONNULL_BEGIN - -/// A crash report processor -@interface RollbarCrashProcessor : NSObject - -@property (nonatomic, readonly) NSUInteger totalProcessedReports; - -@end - -NS_ASSUME_NONNULL_END diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashProcessor.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashProcessor.m deleted file mode 100644 index 27b3ff4a..00000000 --- a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashProcessor.m +++ /dev/null @@ -1,29 +0,0 @@ -#import "RollbarCrashProcessor.h" -#import "Rollbar.h" - -@implementation RollbarCrashProcessor - -- (void)onCrashReportsCollectionCompletion:(NSArray *)crashReports { - - self->_totalProcessedReports += crashReports.count; - - for (RollbarCrashReportData *crashRecord in crashReports) { - [Rollbar logCrashReport:crashRecord.crashReport]; - - // Let's sleep this thread for a few seconds to give the items processing thread a chance - // to send the payload logged above so that we can handle cases when the SDK is initialized - // right/shortly before a persistent application crash (that we have no control over) if any: - [NSThread sleepForTimeInterval:5.0f]; // [sec] - } -} - -- (instancetype)init { - - if ((self = [super init])) { - - self->_totalProcessedReports = 0; - } - return self; -} - -@end diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashReportSink.h b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashReportSink.h new file mode 100644 index 00000000..d3acfecb --- /dev/null +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashReportSink.h @@ -0,0 +1,19 @@ +#ifndef RollbarCrashReportSink_h +#define RollbarCrashReportSink_h + +@import Foundation; +@import KSCrash_Reporting_Sinks; + +NS_ASSUME_NONNULL_BEGIN + +/// Rollbar CrashReport sink +@interface RollbarCrashReportSink : NSObject + +/// Gets the default filter set +- (id)defaultFilterSet; + +@end + +NS_ASSUME_NONNULL_END + +#endif //RollbarCrashReportSink_h diff --git a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashReportSink.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashReportSink.m similarity index 87% rename from RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashReportSink.m rename to RollbarNotifier/Sources/RollbarNotifier/RollbarCrashReportSink.m index 5c62c1d2..e483431a 100644 --- a/RollbarKSCrash/Sources/RollbarKSCrash/RollbarKSCrashReportSink.m +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashReportSink.m @@ -1,6 +1,6 @@ -#import "RollbarKSCrashReportSink.h" +#import "RollbarCrashReportSink.h" -@implementation RollbarKSCrashReportSink +@implementation RollbarCrashReportSink - (id)defaultFilterSet { KSCrashReportFilterAppleFmt *format = [KSCrashReportFilterAppleFmt filterWithReportStyle:KSAppleReportStyleSymbolicated]; diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarInfrastructure.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarInfrastructure.m index 72589e23..e24aa208 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/RollbarInfrastructure.m +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarInfrastructure.m @@ -3,31 +3,26 @@ #import "RollbarLoggerProtocol.h" #import "RollbarLogger.h" #import "RollbarNotifierFiles.h" -#import "RollbarCrashProcessor.h" #import "RollbarSession.h" #import "RollbarTelemetry.h" +#import "RollbarCrashCollector.h" -@implementation RollbarInfrastructure { - @private - RollbarConfig *_configuration; - RollbarLogger *_logger; - RollbarCrashProcessor *_crashProcessor; -} +NS_ASSUME_NONNULL_BEGIN + +@interface RollbarInfrastructure () +@property (readwrite, strong) id logger; +@property (readwrite, strong) RollbarConfig *configuration; +@property (readwrite, strong) RollbarCrashCollector *collector; +@end -#pragma mark - Sigleton pattern +@implementation RollbarInfrastructure + (nonnull instancetype)sharedInstance { - static id singleton; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - singleton = [RollbarInfrastructure new]; - - RollbarSdkLog(@"%@ singleton created!", - [RollbarInfrastructure rollbar_objectClassName] - ); }); return singleton; @@ -36,135 +31,34 @@ + (nonnull instancetype)sharedInstance { #pragma mark - instance methods - (nonnull instancetype)configureWith:(nonnull RollbarConfig *)config { - - return [self configureWith:config - andCrashCollector:nil]; -} -- (nonnull instancetype)configureWith:(nonnull RollbarConfig *)config - andCrashCollector:(nullable id)crashCollector { - - [self assertValidConfiguration:config]; - - if (self->_configuration - && self->_configuration.modifyRollbarData == config.modifyRollbarData - && self->_configuration.checkIgnoreRollbarData == config.checkIgnoreRollbarData - && [[self->_configuration serializeToJSONString] isEqualToString:[config serializeToJSONString]] - ) { - return self; // no need to reconfigure with an identical configuration... + if (self.configuration && + self.configuration.modifyRollbarData == config.modifyRollbarData && + self.configuration.checkIgnoreRollbarData == config.checkIgnoreRollbarData && + [[self.configuration serializeToJSONString] isEqualToString:[config serializeToJSONString]] + ) { + return self; } - self->_configuration = [config copy]; - self->_logger = nil; //will be created as needed using the current self->_configuration... - - RollbarCrashReportCheck crashReportCheck = nil; - if (crashCollector) { - - self->_crashProcessor = [RollbarCrashProcessor new]; - [crashCollector collectCrashReportsWithObserver:self->_crashProcessor]; - crashReportCheck = ^() { - - BOOL result = NO; - if (self->_crashProcessor.totalProcessedReports > 0) { - - result = YES; - } - return result; - }; - } + self.configuration = [config copy]; + self.logger = [RollbarLogger loggerWithConfiguration:self.configuration]; + + self.collector = [[RollbarCrashCollector alloc] init]; + [self.collector collectCrashReports]; - [[RollbarSession sharedInstance] enableOomMonitoring:config.loggingOptions.enableOomDetection - withCrashCheck:crashReportCheck]; + [[RollbarSession sharedInstance] enableOomMonitoring:config.loggingOptions.enableOomDetection withCrashCheck:^() { + return (BOOL)(self.collector.totalProcessedReports > 0); + }]; [[RollbarTelemetry sharedInstance] configureWithOptions:config.telemetry]; - RollbarSdkLog(@"%@ is configured with this RollbarConfig instance: \n%@ \nand crash collector %@", + RollbarSdkLog(@"%@ is configured with this RollbarConfig instance: \n%@", [RollbarInfrastructure rollbar_objectClassName], - config, - crashCollector - ); + config); return self; } -- (nonnull id)createLogger { - - return [self createLoggerWithConfig:self.configuration]; -} - -- (nonnull id)createLoggerWithConfig:(nonnull RollbarConfig *)config { - - RollbarLogger *logger = [RollbarLogger loggerWithConfiguration:config]; - return logger; -} - -- (nonnull id)createLoggerWithAccessToken:(nonnull NSString *)token - andEnvironment:(nonnull NSString *)env { - - RollbarMutableConfig *config = [self.configuration mutableCopy]; - config.destination.accessToken = token; - config.destination.environment = env; - id logger = [self createLoggerWithConfig:config]; - return logger; -} - -- (nonnull id)createLoggerWithAccessToken:(nonnull NSString *)token { - - RollbarMutableConfig *config = [self.configuration mutableCopy]; - config.destination.accessToken = token; - id logger = [self createLoggerWithConfig:config]; - return logger; -} - -#pragma mark - properties - -- (nonnull RollbarConfig *)configuration { - - [self assertValidConfiguration:self->_configuration]; - if (YES == [self hasValidConfiguration]) { - return self->_configuration; - } - else { - [self raiseNotConfiguredException]; - return nil; - } -} - -- (nonnull id)logger { - - if (!self->_logger) { - self->_logger = [RollbarLogger loggerWithConfiguration:self.configuration]; - } - - return self->_logger; -} - -#pragma mark - internal methods - -- (void)raiseNotConfiguredException { - [NSException raise:@"RollbarInfrastructureNotConfiguredException" - format:@"Make sure the [[RollbarInfrastructure sharedInstance] configureWith:...] is called " - "providing a valid RollbarConfig instance!" - ]; -} - -- (BOOL)hasValidConfiguration { - - if (!self->_configuration) { - return NO; - } - - //TODO: complete full validation implementation... - - return YES; -} - -- (void)assertValidConfiguration:(nullable RollbarConfig *)config { - - NSAssert(config, - @"Provide valid configuration via [[RollbarInfrastructure sharedInstance] configureWith:...]!"); - - //TODO: complete full validation implementation... -} - @end + +NS_ASSUME_NONNULL_END diff --git a/RollbarNotifier/Sources/RollbarNotifier/include/Rollbar.h b/RollbarNotifier/Sources/RollbarNotifier/include/Rollbar.h index 20eee813..c98c0afe 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/include/Rollbar.h +++ b/RollbarNotifier/Sources/RollbarNotifier/include/Rollbar.h @@ -8,10 +8,7 @@ #import "RollbarTelemetry.h" #import "RollbarTelemetryType.h" -#import "RollbarCrashCollectorProtocol.h" #import "RollbarConfig.h" -//#import "RollbarLogger.h" - #pragma mark - Initialization Facade Protocol @@ -20,34 +17,17 @@ @required -/// Class initializer. -/// @param accessToken Rollbar project access token -+ (void)initWithAccessToken:(nonnull NSString *)accessToken; - -@optional - /// Class initializer. /// @param configuration a Rollbar configuration + (void)initWithConfiguration:(nonnull RollbarConfig *)configuration; -/// Class initializer. -/// @param accessToken a Rollbar project access token -/// @param crashCollector a crash collector -+ (void)initWithAccessToken:(nonnull NSString *)accessToken - crashCollector:(nullable id)crashCollector; - -/// Class initializer. -/// @param configuration a Rollbar configuration -/// @param crashCollector a crash collector -+ (void)initWithConfiguration:(nonnull RollbarConfig *)configuration - crashCollector:(nullable id)crashCollector; @end #pragma mark - Configuration Facade Protocol /// Rollbar facade configuration protocol -@protocol RollbarFacadeConfiguration // +@protocol RollbarFacadeConfiguration @required @@ -64,7 +44,7 @@ #pragma mark - Logging Facade Protocol /// Rollbar facade logging protocol -@protocol RollbarFacadeLogging // +@protocol RollbarFacadeLogging @required @@ -423,7 +403,7 @@ #pragma mark - Telemetry Facade Protocol /// Rollbar facade telemetry protocol -@protocol RollbarFacadeTelemetry // +@protocol RollbarFacadeTelemetry @required @@ -527,8 +507,7 @@ #pragma mark - Rollbar Facade Utility Class /// Rollbar facade utility class -@interface Rollbar -: NSObject +@interface Rollbar : NSObject #pragma mark - Send manually constructed JSON payload @@ -569,6 +548,4 @@ // -(BOOL)application:didFinishLaunchingWithOptions: method in AppDelegate. static void uncaughtExceptionHandler(NSException * _Nonnull exception); - - #endif //Rollbar_h diff --git a/RollbarNotifier/Sources/RollbarNotifier/include/RollbarInfrastructure.h b/RollbarNotifier/Sources/RollbarNotifier/include/RollbarInfrastructure.h index c464b56f..35905119 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/include/RollbarInfrastructure.h +++ b/RollbarNotifier/Sources/RollbarNotifier/include/RollbarInfrastructure.h @@ -1,51 +1,22 @@ -// -// RollbarInfrastructure.h -// -// -// Created by Andrey Kornich on 2022-06-09. -// - #ifndef RollbarInfrastructure_h #define RollbarInfrastructure_h #import - #import "RollbarLoggerProtocol.h" #import "RollbarConfig.h" -#import "RollbarCrashCollectorProtocol.h" NS_ASSUME_NONNULL_BEGIN @interface RollbarInfrastructure : NSObject -#pragma mark - propeties - -@property(readonly, nonnull) RollbarConfig *configuration; -@property(readonly, nonnull) id logger; - -#pragma mark - instance methods - -- (nonnull instancetype)configureWith:(nonnull RollbarConfig *)config; -- (nonnull instancetype)configureWith:(nonnull RollbarConfig *)config - andCrashCollector:(nullable id)crashCollector; -- (nonnull id)createLogger; -- (nonnull id)createLoggerWithConfig:(nonnull RollbarConfig *)config; -- (nonnull id)createLoggerWithAccessToken:(nonnull NSString *)token - andEnvironment:(nonnull NSString *)env; -- (nonnull id)createLoggerWithAccessToken:(nonnull NSString *)token; - -#pragma mark - class methods +@property (readonly, strong) RollbarConfig *configuration; +@property (readonly, strong) id logger; -//+ (nonnull id)sharedLogger; -//+ (nonnull id)newLogger; -//+ (nonnull id)newLoggerWithConfig:(nonnull RollbarConfig *)config; -//+ (nonnull id)newLoggerWithAccessToken:(nonnull NSString *)token -// andEnvironment:(nonnull NSString *)env; -//+ (nonnull id)newLoggerWithAccessToken:(nonnull NSString *)token; +- (instancetype)configureWith:(RollbarConfig *)config; #pragma mark - Sigleton pattern -+ (nonnull instancetype)sharedInstance; ++ (instancetype)sharedInstance; + (instancetype)new NS_UNAVAILABLE; + (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; diff --git a/RollbarPLCrashReporter.podspec b/RollbarPLCrashReporter.podspec deleted file mode 100644 index 491a66e9..00000000 --- a/RollbarPLCrashReporter.podspec +++ /dev/null @@ -1,71 +0,0 @@ -# -# Be sure to run `pod spec lint RollbarPLCrashReporter.podspec' to ensure this is a valid spec. -# -# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html -# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ -# - -Pod::Spec.new do |s| - - s.version = "2.4.0" - s.name = "RollbarPLCrashReporter" - s.summary = "Application or client side SDK for interacting with the Rollbar API Server." - s.description = <<-DESC - Find, fix, and resolve errors with Rollbar. - Easily send error data using Rollbar API. - Analyze, de-dupe, send alerts, and prepare the data for further analysis. - Search, sort, and prioritize via the Rollbar dashboard. - DESC - s.homepage = "https://rollbar.com" - # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" - s.license = { :type => "MIT", :file => "LICENSE" } - # s.license = "MIT (example)" - s.documentation_url = "https://docs.rollbar.com/docs/apple" - s.authors = { "Andrey Kornich (Wide Spectrum Computing LLC)" => "akornich@gmail.com", - "Rollbar" => "support@rollbar.com" } - # s.author = { "Andrey Kornich" => "akornich@gmail.com" } - # Or just: s.author = "Andrey Kornich" - s.social_media_url = "http://twitter.com/rollbar" - s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", - :tag => "#{s.version}" - } - s.resource = "rollbar-logo.png" - # s.resources = "Resources/*.png" - - # When using multiple platforms: - s.osx.deployment_target = "10.15" - s.ios.deployment_target = "13.0" - s.tvos.deployment_target = "13.0" - # s.watchos.deployment_target = "7.0" - # Any platform, if omitted: - # s.platform = :ios - # s.platform = :ios, "5.0" - - s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" - s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" - s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" - # s.exclude_files = "Classes/Exclude" - # s.preserve_paths = "FilesToSave", "MoreFilesToSave" - - s.static_framework = true - s.framework = "Foundation" - s.dependency "RollbarCommon", "~> #{s.version}" - s.dependency "PLCrashReporter", "~> 1.10.1" - # s.frameworks = "SomeFramework", "AnotherFramework" - # s.library = "iconv" - # s.libraries = "iconv", "xml2" - # s.dependency "JSONKit", "~> 1.4" - - s.requires_arc = true - # s.xcconfig = { - # "USE_HEADERMAP" => "NO", - # "HEADER_SEARCH_PATHS" => "$(PODS_ROOT)/Sources/#{s.name}/**" - # } - - # s.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } - # s.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } - - # s.tvos.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } - # s.tvos.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } - -end diff --git a/RollbarSDK.xcworkspace/contents.xcworkspacedata b/RollbarSDK.xcworkspace/contents.xcworkspacedata index e4b5a734..040baa7f 100644 --- a/RollbarSDK.xcworkspace/contents.xcworkspacedata +++ b/RollbarSDK.xcworkspace/contents.xcworkspacedata @@ -28,9 +28,6 @@ - - @@ -40,12 +37,6 @@ - - - - @@ -68,9 +59,6 @@ - - diff --git a/RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme b/RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme index 028e5fa8..545a891e 100644 --- a/RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme +++ b/RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme @@ -1,6 +1,6 @@ crashCollector = [[RollbarPLCrashCollector alloc] init]; - //OR [[RollbarKSCrashCollector alloc] init]; + //OR [[RollbarCrashCollector alloc] init]; //OR nil; ``` @@ -166,7 +166,7 @@ id crashCollector = ```Swift let crashCollector = RollbarPLCrashCollector() -//OR let crashCollector = RollbarKSCrashCollector() +//OR let crashCollector = RollbarCrashCollector() ``` ### Initialize the Shared Notifier @@ -199,4 +199,4 @@ Rollbar.initWithConfiguration(config) Rollbar.infoMessage("See this message on your Rollbar Project Dashboard...") ``` -There are other dedicated method overloads for logging `NSException`s, `NSError`s with different levels of log severity. \ No newline at end of file +There are other dedicated method overloads for logging `NSException`s, `NSError`s with different levels of log severity.