├── UnitTesting ├── README.md ├── .gitignore ├── .swiftpm │ └── xcode │ │ └── package.xcworkspace │ │ └── contents.xcworkspacedata ├── Tests │ └── UnitTestingTests │ │ └── UnitTestingTests.swift ├── Package.swift └── Sources │ └── UnitTesting │ └── RollbarTestHelper.swift ├── rollbar-logo.png ├── RollbarAUL ├── .gitignore ├── Sources │ └── RollbarAUL │ │ ├── include │ │ ├── module.modulemap │ │ ├── RollbarAulEntrySnapper.h │ │ ├── RollbarAulLogLevelConverter.h │ │ ├── RollbarAulStoreMonitor.h │ │ └── RollbarAulOSLogEntryLogLevelConverter.h │ │ └── RollbarAulLogLevelConverter.m ├── Tests │ ├── LinuxMain.swift │ └── RollbarAULTests │ │ ├── XCTestManifests.swift │ │ └── RollbarAULTests.swift ├── README.md └── Package.swift ├── RollbarCommon ├── .gitignore ├── Sources │ └── RollbarCommon │ │ ├── include │ │ ├── module.modulemap │ │ ├── RollbarDTOAbstraction.h │ │ ├── NSObject+Rollbar.h │ │ ├── NSDate+Rollbar.h │ │ ├── RollbarBundleUtil.h │ │ ├── RollbarHostingProcessUtil.h │ │ ├── RollbarPersistent.h │ │ ├── NSDictionary+Rollbar.h │ │ ├── RollbarFileWriter.h │ │ ├── RollbarOsUtil.h │ │ ├── RollbarTriStateFlag.h │ │ ├── RollbarCachesDirectory.h │ │ ├── RollbarFileReader.h │ │ ├── RollbarSingleInstancing.h │ │ ├── NSJSONSerialization+Rollbar.h │ │ ├── RollbarMemoryUtil.h │ │ ├── RollbarCrashReportUtil.h │ │ ├── RollbarDTO+CustomData.h │ │ └── RollbarJSONSupport.h │ │ ├── NSObject+Rollbar.m │ │ ├── RollbarInternalLogging.h │ │ ├── DesignPatterns │ │ ├── Creational │ │ │ ├── RollbarPrototype.h │ │ │ ├── RollbarBuilder.m │ │ │ └── RollbarBuilder.h │ │ ├── RollbarTaskDispatcher.m │ │ └── RollbarReceptionist.m │ │ ├── RollbarFileIOUtil.h │ │ ├── RollbarHostingProcessUtil.m │ │ ├── RollbarBundleUtil.m │ │ ├── RollbarInternalLogging.m │ │ ├── NSDictionary+Rollbar.m │ │ ├── NSDate+Rollbar.m │ │ ├── RollbarOsUtil.m │ │ ├── RollbarTriStateFlag.m │ │ ├── DTOs │ │ └── RollbarDTO+CustomData.m │ │ └── RollbarFileIOUtil.m ├── Tests │ ├── LinuxMain.swift │ ├── RollbarCommonTests │ │ ├── XCTestManifests.swift │ │ ├── RollbarCommonTests.swift │ │ ├── NSDictionary+RollbarTest.swift │ │ └── RollbarMemoryUtilTests.swift │ └── RollbarCommonTests-ObjC │ │ ├── RollbarBundleUtilTests.m │ │ ├── Mocks │ │ ├── Calculator.h │ │ ├── Person.h │ │ └── Person.m │ │ ├── RollbarHostingProcessUtilTest.m │ │ └── NSDate+RollbarTests.m ├── README.md └── Package.swift ├── RollbarDeploys ├── .gitignore ├── README.md ├── Sources │ └── RollbarDeploys │ │ ├── include │ │ ├── module.modulemap │ │ ├── RollbarDeploysDTOs.h │ │ ├── RollbarDeploymentDetails.h │ │ ├── RollbarDeployApiCallOutcome.h │ │ └── RollbarDeploysManager.h │ │ └── DTOs │ │ ├── DeployApiCallOutcome.m │ │ └── RollbarDeploymentDetails.m ├── Tests │ ├── LinuxMain.swift │ └── RollbarDeploysTests │ │ └── XCTestManifests.swift └── Package.swift ├── RollbarNotifier ├── .gitignore ├── Sources │ ├── RollbarNotifier │ │ ├── DTOs │ │ │ ├── RollbarTelemetryBody.m │ │ │ ├── RollbarTelemetryErrorBody.m │ │ │ ├── RollbarTelemetryManualBody.m │ │ │ ├── RollbarRawCrashReport.m │ │ │ ├── RollbarSource.m │ │ │ ├── RollbarCaptureIpType.m │ │ │ ├── RollbarCallStackFrameContext.m │ │ │ ├── RollbarMessage.m │ │ │ ├── RollbarTelemetryLogBody.m │ │ │ ├── RollbarTelemetryViewBody.m │ │ │ ├── RollbarTelemetryConnectivityBody.m │ │ │ ├── RollbarLevel.m │ │ │ ├── RollbarServer.m │ │ │ ├── RollbarPayload.m │ │ │ ├── RollbarAppLanguage.m │ │ │ ├── RollbarModule.m │ │ │ └── RollbarException.m │ │ ├── include │ │ │ ├── module.modulemap │ │ │ ├── RollbarTelemetryBody.h │ │ │ ├── RollbarTelemetryErrorBody.h │ │ │ ├── RollbarTelemetryManualBody.h │ │ │ ├── RollbarLog.h │ │ │ ├── RollbarRawCrashReport.h │ │ │ ├── RollbarSource.h │ │ │ ├── RollbarMessage.h │ │ │ ├── RollbarAppLanguage.h │ │ │ ├── RollbarLevel.h │ │ │ ├── RollbarCaptureIpType.h │ │ │ ├── RollbarCallStackFrameContext.h │ │ │ ├── RollbarInfrastructure.h │ │ │ ├── RollbarPayload.h │ │ │ ├── RollbarHttpMethod.h │ │ │ ├── RollbarTelemetryType.h │ │ │ ├── RollbarTrace.h │ │ │ ├── RollbarServer.h │ │ │ ├── RollbarTelemetryLogBody.h │ │ │ ├── RollbarTelemetryViewBody.h │ │ │ ├── RollbarProxy.h │ │ │ ├── RollbarException.h │ │ │ ├── RollbarPayloadDTOs.h │ │ │ ├── RollbarTelemetryConnectivityBody.h │ │ │ ├── RollbarModule.h │ │ │ ├── RollbarTelemetryNavigationBody.h │ │ │ └── RollbarPayloadTruncator.h │ │ ├── RollbarLog.m │ │ ├── RollbarInternalLogging.h │ │ ├── RollbarCrashCollector.h │ │ ├── RollbarSender.h │ │ ├── RollbarInternalLogging.m │ │ ├── RollbarRegistry.h │ │ ├── RollbarNotifierFiles.h │ │ ├── RollbarTelemetryOptionsObserver.h │ │ ├── RollbarPayloadPostReply.h │ │ ├── RollbarThread.h │ │ ├── RollbarTelemetryThread.h │ │ ├── RollbarDestinationRecord.h │ │ ├── RollbarNotifierFiles.m │ │ └── RollbarPayloadFactory.h │ └── RollbarCrash │ │ ├── include │ │ ├── module.modulemap │ │ └── RollbarCrashMonitor_System.h │ │ ├── Recording │ │ ├── RollbarCrashDoctor.h │ │ ├── RollbarCrashReportVersion.h │ │ └── RollbarCrashCachedData.h │ │ ├── Util │ │ ├── RollbarCrashID.h │ │ ├── RollbarCrashCxaThrowSwapper.h │ │ └── RollbarCrashDebug.h │ │ └── Monitors │ │ ├── RollbarCrashMonitor_Signal.h │ │ ├── RollbarCrashMonitor_CPPException.h │ │ └── RollbarCrashMonitor_NSException.h ├── README.md ├── .swiftpm │ └── xcode │ │ └── package.xcworkspace │ │ └── contents.xcworkspacedata └── Tests │ ├── LinuxMain.swift │ ├── RollbarNotifierTests │ ├── RollbarNotifierTests-Bridging-Header.h │ ├── RollbarLogger+Test.h │ └── XCTestManifests.swift │ ├── RollbarReportTests │ └── XCTestManifests.swift │ └── RollbarNotifierTests-ObjC │ └── XCTestCase+RollbarNotifierTest.h ├── Examples ├── RollbarObjCDemo │ ├── RollbarObjCDemo │ │ ├── ViewController.h │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Rollbar-Logomark-Safety.png │ │ │ │ └── Contents.json │ │ │ └── AccentColor.colorset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.h │ │ ├── RollbarObjCDemo.entitlements │ │ ├── main.m │ │ ├── AppDelegate.m │ │ └── Base.lproj │ │ │ └── LaunchScreen.storyboard │ └── RollbarObjCDemo.xcodeproj │ │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Integration │ ├── SPMApp │ │ ├── SPMApp │ │ │ ├── Assets.xcassets │ │ │ │ ├── Contents.json │ │ │ │ ├── AccentColor.colorset │ │ │ │ │ └── Contents.json │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ ├── Preview Content │ │ │ │ └── Preview Assets.xcassets │ │ │ │ │ └── Contents.json │ │ │ ├── SPMApp.swift │ │ │ └── ContentView.swift │ │ └── SPMApp.xcodeproj │ │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── swiftpm │ │ │ └── Package.resolved │ ├── CocoapodsApp │ │ ├── CocoapodsApp │ │ │ ├── Assets.xcassets │ │ │ │ ├── Contents.json │ │ │ │ ├── AccentColor.colorset │ │ │ │ │ └── Contents.json │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ ├── Preview Content │ │ │ │ └── Preview Assets.xcassets │ │ │ │ │ └── Contents.json │ │ │ ├── CocoapodsApp.swift │ │ │ └── ContentView.swift │ │ ├── Podfile │ │ ├── CocoapodsApp.xcodeproj │ │ │ └── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ ├── CocoapodsApp.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── Podfile.lock │ ├── CocoapodsFramework │ │ ├── Podfile │ │ ├── CocoapodsFramework.xcodeproj │ │ │ └── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ ├── CocoapodsFramework.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── CocoapodsFramework │ │ │ ├── CocoapodsFramework.h │ │ │ └── CocoapodsFramework.swift │ │ └── Podfile.lock │ └── SPMFramework │ │ ├── SPMFrameworkApp │ │ └── SPMFrameworkApp │ │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── AccentColor.colorset │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ ├── Preview Content │ │ │ └── Preview Assets.xcassets │ │ │ │ └── Contents.json │ │ │ ├── SPMFrameworkApp.swift │ │ │ └── ContentView.swift │ │ ├── SPMFramework.xcodeproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── Makefile │ │ ├── SPMFramework.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── swiftpm │ │ │ └── Package.resolved │ │ └── SPMFramework │ │ ├── SPMFramework.h │ │ └── SPMFramework.swift └── RollbarDemo │ ├── RollbarDemo │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── AppIcon.appiconset │ │ │ ├── Rollbar-Logomark-Safety.png │ │ │ └── Contents.json │ │ └── AccentColor.colorset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── RollbarDemo.entitlements │ └── Prelude.swift │ └── RollbarDemo.xcodeproj │ └── project.xcworkspace │ └── contents.xcworkspacedata ├── .vscode └── settings.json ├── RollbarCocoaLumberjack ├── .gitignore ├── Sources │ └── RollbarCocoaLumberjack │ │ └── include │ │ ├── module.modulemap │ │ └── RollbarCocoaLumberjackLogger.h ├── Tests │ └── LinuxMain.swift ├── .swiftpm │ └── xcode │ │ └── package.xcworkspace │ │ └── contents.xcworkspacedata ├── README.md ├── Package.resolved └── Package.swift ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── docs ├── README.md └── SDK module - RollbarZZZ.md ├── CONTRIBUTING.md ├── RollbarSDK.xcworkspace └── xcshareddata │ ├── WorkspaceSettings.xcsettings │ └── swiftpm │ └── Package.resolved ├── .gitignore ├── Package.resolved ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── pull_request_template.md ├── LICENSE ├── podpub.sh ├── RollbarCommon.podspec ├── RollbarDeploys.podspec ├── RollbarReport.podspec ├── RollbarAUL.podspec └── RollbarCocoaLumberjack.podspec /UnitTesting/README.md: -------------------------------------------------------------------------------- 1 | # UnitTesting 2 | 3 | A description of this package. 4 | -------------------------------------------------------------------------------- /rollbar-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollbar/rollbar-apple/HEAD/rollbar-logo.png -------------------------------------------------------------------------------- /RollbarAUL/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /RollbarCommon/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /RollbarDeploys/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /RollbarNotifier/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | 3 | @interface ViewController : UIViewController 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarTelemetryBody.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTelemetryBody.h" 2 | 3 | @implementation RollbarTelemetryBody 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '14.0' 2 | use_frameworks! 3 | 4 | target 'CocoapodsApp' do 5 | pod 'RollbarNotifier', '~> 3.3.3' 6 | end 7 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /RollbarAUL/Sources/RollbarAUL/include/module.modulemap: -------------------------------------------------------------------------------- 1 | module RollbarAUL { 2 | umbrella "." 3 | 4 | export * 5 | module * { export * } 6 | 7 | requires objc 8 | } 9 | -------------------------------------------------------------------------------- /UnitTesting/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "lldb.library": "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB", 3 | "lldb.launch.expressions": "native" 4 | } 5 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsFramework/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '14.0' 2 | use_frameworks! 3 | 4 | target 'CocoapodsFramework' do 5 | pod 'RollbarNotifier', '~> 3.3.3' 6 | end 7 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFrameworkApp/SPMFrameworkApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /RollbarAUL/Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import RollbarAULTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += RollbarAULTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /RollbarDeploys/README.md: -------------------------------------------------------------------------------- 1 | # RollbarDeploys 2 | 3 | This is an SDK module implementing client classes aiding in interacting with Rollbar REST API related to deployment management. 4 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarTelemetryErrorBody.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTelemetryErrorBody.h" 2 | 3 | @implementation RollbarTelemetryErrorBody 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarTelemetryManualBody.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTelemetryManualBody.h" 2 | 3 | @implementation RollbarTelemetryManualBody 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | xcuserdata/ 6 | DerivedData/ 7 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata 8 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/module.modulemap: -------------------------------------------------------------------------------- 1 | module RollbarCommon { 2 | umbrella "." 3 | 4 | export * 5 | module * { export * } 6 | 7 | requires objc 8 | } 9 | -------------------------------------------------------------------------------- /RollbarDeploys/Sources/RollbarDeploys/include/module.modulemap: -------------------------------------------------------------------------------- 1 | module RollbarDeploys { 2 | umbrella "." 3 | 4 | export * 5 | module * { export * } 6 | 7 | requires objc 8 | } 9 | -------------------------------------------------------------------------------- /RollbarNotifier/README.md: -------------------------------------------------------------------------------- 1 | # RollbarNotifier 2 | 3 | This is an SDK module implementing client classes aiding in interacting with Rollbar REST API related to deployment management. 4 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import RollbarCommonTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += RollbarCommonTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/module.modulemap: -------------------------------------------------------------------------------- 1 | module RollbarNotifier { 2 | umbrella "." 3 | 4 | export * 5 | module * { export * } 6 | 7 | requires objc 8 | } 9 | -------------------------------------------------------------------------------- /RollbarDeploys/Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import RollbarDeploysTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += RollbarDeploysTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/include/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module RollbarCrash { 2 | umbrella "." 3 | 4 | export * 5 | module * { export * } 6 | 7 | requires objc 8 | } 9 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFrameworkApp/SPMFrameworkApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/Sources/RollbarCocoaLumberjack/include/module.modulemap: -------------------------------------------------------------------------------- 1 | module RollbarCocoaLumberjack { 2 | umbrella "." 3 | 4 | export * 5 | module * { export * } 6 | 7 | requires objc 8 | } 9 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import RollbarCocoaLumberjackTests 4 | 5 | var tests = [XCTestCaseEntry]() 6 | tests += RollbarCocoaLumberjackTests.allTests() 7 | XCTMain(tests) 8 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | 3 | @interface AppDelegate : UIResponder 4 | 5 | @property (nullable, nonatomic, strong) UIWindow *window; 6 | 7 | @end 8 | 9 | -------------------------------------------------------------------------------- /RollbarNotifier/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RollbarNotifier/Tests/LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | import RollbarNotifierTests 4 | import RollbarReportTests 5 | 6 | XCTMain([ 7 | RollbarNotifierTests.allTests(), 8 | RollbarReportTests.allTests(), 9 | ]) 10 | -------------------------------------------------------------------------------- /UnitTesting/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo/Assets.xcassets/AppIcon.appiconset/Rollbar-Logomark-Safety.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollbar/rollbar-apple/HEAD/Examples/RollbarDemo/RollbarDemo/Assets.xcassets/AppIcon.appiconset/Rollbar-Logomark-Safety.png -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Rollbar-Apple SDK Documentation Folder 2 | 3 | 4 | # Help / Support 5 | 6 | If you run into any problems, please email us at `support@rollbar.com` or [file a bug report](https://github.com/rollbar/rollbar-apple/issues/new). 7 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/Assets.xcassets/AppIcon.appiconset/Rollbar-Logomark-Safety.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollbar/rollbar-apple/HEAD/Examples/RollbarObjCDemo/RollbarObjCDemo/Assets.xcassets/AppIcon.appiconset/Rollbar-Logomark-Safety.png -------------------------------------------------------------------------------- /RollbarAUL/Tests/RollbarAULTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | return [ 6 | testCase(RollbarAULTests.allTests), 7 | ] 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/RollbarObjCDemo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RollbarDeploys/Tests/RollbarDeploysTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | return [ 6 | testCase(RollbarDeploysTests.allTests), 7 | ] 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsFramework/CocoapodsFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/NSObject+Rollbar.m: -------------------------------------------------------------------------------- 1 | #import "NSObject+Rollbar.h" 2 | 3 | @implementation NSObject (Rollbar) 4 | 5 | - (nonnull NSString *)rollbar_objectClassName { 6 | 7 | return NSStringFromClass(self.class); 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | 1. Fork it 4 | 2. Create your feature branch (`git checkout -b my-new-feature`) 5 | 3. Commit your changes (`git commit -am 'Added some feature'`) 6 | 4. Push to the branch (`git push origin my-new-feature`) 7 | 5. Create new Pull Request 8 | -------------------------------------------------------------------------------- /RollbarNotifier/Tests/RollbarNotifierTests/RollbarNotifierTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarNotifierTests-Bridging-Header.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2020-06-02. 6 | // 7 | 8 | #import "RollbarLogger.h" 9 | #import "RollbarLogger+Test.h" 10 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFrameworkApp/SPMFrameworkApp/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /RollbarCommon/README.md: -------------------------------------------------------------------------------- 1 | # RollbarCommon 2 | 3 | This is an SDK module declaring abstractions/concepts (protocols, abstract classes, etc.) and implementing classes/types commonly used across the other SDK modules. 4 | 5 | If any data type is used by more than one SDK module - place it here. 6 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | xcodebuild archive \ 3 | -workspace SPMFramework.xcworkspace \ 4 | -scheme SPMFramework \ 5 | -derivedDataPath "build" \ 6 | BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ 7 | OTHER_SWIFT_FLAGS="$(inherited) -no-verify-emitted-module-interface" 8 | -------------------------------------------------------------------------------- /RollbarNotifier/Tests/RollbarReportTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | #if !os(watchOS) 2 | import XCTest 3 | 4 | #if !canImport(ObjectiveC) 5 | public func allTests() -> [XCTestCaseEntry] { 6 | return [ 7 | testCase(RollbarReportTests.allTests), 8 | ] 9 | } 10 | #endif 11 | #endif 12 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarDTOAbstraction.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarDTOAbstraction_h 2 | #define RollbarDTOAbstraction_h 3 | 4 | #import "RollbarJSONSupport.h" 5 | #import "RollbarPersistent.h" 6 | #import "RollbarDTO.h" 7 | #import "RollbarDTO+CustomData.h" 8 | 9 | #endif //RollbarDTOAbstraction_h 10 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RollbarNotifier/Tests/RollbarNotifierTests/RollbarLogger+Test.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarLogger+Test.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2020-06-02. 6 | // 7 | 8 | @class NSThread; 9 | 10 | @interface RollbarLogger (Test) 11 | 12 | - (NSThread *)_rollbarThread; 13 | 14 | - (void)_test_doNothing; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFrameworkApp/SPMFrameworkApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarLog.m: -------------------------------------------------------------------------------- 1 | #import "RollbarLog.h" 2 | #import "RollbarTelemetry.h" 3 | 4 | void RollbarLog(NSString *format, ...) { 5 | va_list args; 6 | va_start(args, format); 7 | [RollbarTelemetry NSLogReplacement:[[NSString alloc] initWithFormat:format arguments:args]]; 8 | va_end(args); 9 | } 10 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFrameworkApp/SPMFrameworkApp/SPMFrameworkApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import SPMFramework 3 | 4 | @main 5 | struct SPMFrameworkApp: App { 6 | init() { 7 | SPMEntryPoint.start() 8 | } 9 | 10 | var body: some Scene { 11 | WindowGroup { 12 | ContentView() 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsFramework/CocoapodsFramework.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Rollbar-Logomark-Safety.png", 5 | "idiom" : "universal", 6 | "platform" : "ios", 7 | "size" : "1024x1024" 8 | } 9 | ], 10 | "info" : { 11 | "author" : "xcode", 12 | "version" : 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFramework.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Rollbar-Logomark-Safety.png", 5 | "idiom" : "universal", 6 | "platform" : "ios", 7 | "size" : "1024x1024" 8 | } 9 | ], 10 | "info" : { 11 | "author" : "xcode", 12 | "version" : 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryBody.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryBody_h 2 | #define RollbarTelemetryBody_h 3 | 4 | @import RollbarCommon; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Telemetry body DTO 9 | @interface RollbarTelemetryBody : RollbarDTO 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | 15 | #endif //RollbarTelemetryBody_h 16 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarInternalLogging.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarInternalLogging_h 2 | #define RollbarInternalLogging_h 3 | 4 | @import Foundation; 5 | 6 | // This is for internal usage only 7 | void RBCLog(NSString *format, ...); 8 | 9 | // This is for internal usage only 10 | void RBCErr(NSString *format, ...); 11 | 12 | #endif /* RollbarInternalLogging_h */ 13 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFrameworkApp/SPMFrameworkApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import SPMFramework 3 | 4 | struct ContentView: View { 5 | var body: some View { 6 | HelloWorld(title: "Hello World!") 7 | } 8 | } 9 | 10 | struct ContentView_Previews: PreviewProvider { 11 | static var previews: some View { 12 | ContentView() 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarInternalLogging.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarNotifierInternalLogging_h 2 | #define RollbarNotifierInternalLogging_h 3 | 4 | @import Foundation; 5 | 6 | // This is for internal usage only 7 | void RBLog(NSString *format, ...); 8 | 9 | // This is for internal usage only 10 | void RBErr(NSString *format, ...); 11 | 12 | #endif /* RollbarNotifierInternalLogging_h */ 13 | -------------------------------------------------------------------------------- /RollbarSDK.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | PreviewsEnabled 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo/RollbarDemo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | #if !canImport(ObjectiveC) 4 | public func allTests() -> [XCTestCaseEntry] { 5 | return [ 6 | testCase(RollbarCommonTests.allTests), 7 | testCase(RollbarTriStateFlagTests.allTests), 8 | testCase(NSJSONSerializationRollbarTests.allTests), 9 | testCase(NSDictionaryRollbarTests.allTests), 10 | ] 11 | } 12 | #endif 13 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryErrorBody.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryErrorBody_h 2 | #define RollbarTelemetryErrorBody_h 3 | 4 | #import "RollbarTelemetryLogBody.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Telemetry error event's body 9 | @interface RollbarTelemetryErrorBody : RollbarTelemetryLogBody 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | 15 | #endif //RollbarTelemetryErrorBody_h 16 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryManualBody.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryManualBody_h 2 | #define RollbarTelemetryManualBody_h 3 | 4 | #import "RollbarTelemetryBody.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Telemetry manual event body DTO 9 | @interface RollbarTelemetryManualBody : RollbarTelemetryBody 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | 15 | #endif //RollbarTelemetryManualBody_h 16 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/DesignPatterns/Creational/RollbarPrototype.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarPrototype_h 2 | #define RollbarPrototype_h 3 | 4 | @import Foundation; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Prototype pattern protocol. 9 | @protocol RollbarPrototype <__covariant Type> 10 | 11 | /// Protoype cloning method. 12 | - (__kindof Type)clone; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | 18 | #endif //RollbarPrototype_h 19 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarFileIOUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarFileIOUtil.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-01. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface RollbarFileIOUtil : NSObject 13 | 14 | + (nullable NSURL *)applicationSupportDirectory; 15 | + (nullable NSURL *)applicationCachesDirectory; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/NSObject+Rollbar.h: -------------------------------------------------------------------------------- 1 | #ifndef NSObject_Rollbar_h 2 | #define NSObject_Rollbar_h 3 | 4 | #import 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Rollbar category for NSObject 9 | @interface NSObject (Rollbar) 10 | 11 | /// Returns object's class name 12 | - (nonnull NSString *)rollbar_objectClassName; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | 18 | #endif //NSObject_Rollbar_h 19 | -------------------------------------------------------------------------------- /UnitTesting/Tests/UnitTestingTests/UnitTestingTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import UnitTesting 3 | 4 | final class UnitTestingTests: XCTestCase { 5 | // func testExample() throws { 6 | // // This is an example of a functional test case. 7 | // // Use XCTAssert and related functions to verify your tests produce the correct 8 | // // results. 9 | // XCTAssertEqual(UnitTesting().text, "Hello, World!") 10 | // } 11 | } 12 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "AppDelegate.h" 3 | 4 | int main(int argc, char * argv[]) { 5 | NSString *appDelegateClassName; 6 | 7 | @autoreleasepool { 8 | // Setup code that might create autoreleased objects goes here. 9 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 10 | } 11 | 12 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 13 | } 14 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashDoctor.h 3 | // RollbarCrash 4 | // 5 | // Created by Karl Stenerud on 2012-11-10. 6 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RollbarCrashDoctor : NSObject 12 | 13 | + (RollbarCrashDoctor*) doctor; 14 | 15 | - (NSString*) diagnoseCrash:(NSDictionary*) crashReport; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarCrashCollector_h 2 | #define RollbarCrashCollector_h 3 | 4 | @import Foundation; 5 | @import RollbarCommon; 6 | @import RollbarCrash; 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | /// Rollbar crash report collector 11 | @interface RollbarCrashCollector: RollbarCrashInstallation 12 | 13 | - (void)sendAllReports; 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | 19 | #endif //RollbarCrashCollector_h 20 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFramework/SPMFramework.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for SPMFramework. 4 | FOUNDATION_EXPORT double SPMFrameworkVersionNumber; 5 | 6 | //! Project version string for SPMFramework. 7 | FOUNDATION_EXPORT const unsigned char SPMFrameworkVersionString[]; 8 | 9 | // In this header, you should import all the public headers of your framework using statements like #import 10 | 11 | 12 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp/SPMApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import RollbarNotifier 3 | 4 | @main 5 | struct SPMApp: App { 6 | init() { 7 | let config = RollbarConfig.mutableConfig(withAccessToken: "ACCESSTOKEN") 8 | config.developerOptions.suppressSdkInfoLogging = false 9 | 10 | Rollbar.initWithConfiguration(config) 11 | } 12 | 13 | var body: some Scene { 14 | WindowGroup { 15 | ContentView() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "display-p3", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0xFF", 9 | "green" : "0x72", 10 | "red" : "0x3C" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/DesignPatterns/Creational/RollbarBuilder.m: -------------------------------------------------------------------------------- 1 | #import "RollbarBuilder.h" 2 | 3 | @implementation RollbarEntity 4 | 5 | - (instancetype)initWithBuilder:(RollbarEntityBuilder *)builder { 6 | if (self = [super init]) { 7 | _ID = builder.ID; 8 | } 9 | return self; 10 | } 11 | 12 | @end 13 | 14 | @implementation RollbarEntityBuilder 15 | 16 | - (RollbarEntity *)build { 17 | return [[RollbarEntity alloc] initWithBuilder:self]; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "display-p3", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0xFF", 9 | "green" : "0x72", 10 | "red" : "0x3C" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp/CocoapodsApp.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import RollbarNotifier 3 | 4 | @main 5 | struct CocoapodsApp: App { 6 | init() { 7 | let config = RollbarConfig.mutableConfig(withAccessToken: "ACCESSTOKEN") 8 | config.developerOptions.suppressSdkInfoLogging = false 9 | 10 | Rollbar.initWithConfiguration(config) 11 | } 12 | 13 | var body: some Scene { 14 | WindowGroup { 15 | ContentView() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarHostingProcessUtil.m: -------------------------------------------------------------------------------- 1 | #import "RollbarHostingProcessUtil.h" 2 | 3 | @implementation RollbarHostingProcessUtil 4 | 5 | + (NSString *)getHostingProcessName { 6 | 7 | NSString *processName = [[NSProcessInfo processInfo] processName]; 8 | return processName; 9 | } 10 | 11 | + (int)getHostingProcessIdentifier { 12 | 13 | int processIdentifier = [[NSProcessInfo processInfo] processIdentifier]; 14 | return processIdentifier; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /RollbarAUL/Tests/RollbarAULTests/RollbarAULTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import RollbarAUL 3 | 4 | final class RollbarAULTests: XCTestCase { 5 | func testExample() { 6 | // This is an example of a functional test case. 7 | // Use XCTAssert and related functions to verify your tests produce the correct 8 | // results. 9 | //XCTAssertEqual(RollbarAUL().text, "Hello, World!") 10 | } 11 | 12 | static var allTests = [ 13 | ("testExample", testExample), 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsFramework/CocoapodsFramework/CocoapodsFramework.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | //! Project version number for CocoapodsFramework. 4 | FOUNDATION_EXPORT double CocoapodsFrameworkVersionNumber; 5 | 6 | //! Project version string for CocoapodsFramework. 7 | FOUNDATION_EXPORT const unsigned char CocoapodsFrameworkVersionString[]; 8 | 9 | // In this header, you should import all the public headers of your framework using statements like #import 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/SDK module - RollbarZZZ.md: -------------------------------------------------------------------------------- 1 | # SDK Module: RollbarZZZ 2 | 3 | This module implements components useful in cases when the SDK is used ... 4 | 5 | --- 6 | 7 | ## Essential Components of the Module 8 | 9 | ### `RollbarComp1` 10 | 11 | This utility class provides ... 12 | 13 | ### `RollbarComp2` 14 | 15 | This component is meant to be initialized with ... 16 | 17 | ## Examples 18 | 19 | ### Example title 20 | 21 | #### Objective-C 22 | 23 | ```Obj-C 24 | 25 | ``` 26 | 27 | #### Swift 28 | 29 | ```Swift 30 | 31 | ``` 32 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/NSDate+Rollbar.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Rollbar.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-04-27. 6 | // 7 | 8 | #ifndef NSDate_Rollbar_h 9 | #define NSDate_Rollbar_h 10 | 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface NSDate(Rollbar) 16 | 17 | + (nullable NSDate *)rollbar_dateFromString:(nonnull NSString *)dateString; 18 | - (nonnull NSString *)rollbar_toString; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | 24 | #endif //NSObject_Rollbar_h 25 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarSender.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarSender.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-10. 6 | // 7 | 8 | #import 9 | 10 | @class RollbarConfig; 11 | @class RollbarPayloadPostReply; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface RollbarSender : NSObject 16 | 17 | - (nullable RollbarPayloadPostReply *)sendPayload:(nonnull NSData *)payload 18 | usingConfig:(nonnull RollbarConfig *)config; 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /RollbarDeploys/Sources/RollbarDeploys/include/RollbarDeploysDTOs.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarDeploysDTOs.h 3 | // Rollbar 4 | // 5 | // Created by Andrey Kornich on 2019-12-24. 6 | // Copyright © 2019 Rollbar. All rights reserved. 7 | // 8 | 9 | #ifndef RollbarDeploysDTOs_h 10 | #define RollbarDeploysDTOs_h 11 | 12 | // Deploy API DTOs: 13 | #import "RollbarDeployment.h" 14 | #import "RollbarDeploymentDetails.h" 15 | #import "RollbarDeployApiCallResult.h" 16 | 17 | // Deploy API enums: 18 | #import "RollbarDeployApiCallOutcome.h" 19 | 20 | #endif /* RollbarDeploysDTOs_h */ 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | IDEWorkspaceChecks.plist 21 | 22 | #CocoaPods 23 | Pods 24 | 25 | Dist/ 26 | 27 | *.swp 28 | 29 | build/ 30 | 31 | build_wrapper_output_directory/ 32 | 33 | _ General AUL Entries Bulk Capture.txt 34 | 35 | _ AUL Entries Capture Samples.txt 36 | 37 | .build/ 38 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/README.md: -------------------------------------------------------------------------------- 1 | # RollbarCocoaLumberjack 2 | 3 | 4 | This SDK module implements integration of Rollbar into the popular CocoaLumberjack logging framework. 5 | 6 | So if you either already use CocoaLumberjack or you are planning to use it for your software product logging needs, 7 | then you can easily integrate Rollbar into it via this module and have all or some of the logs performed via the 8 | CocoaLumberjack framework redirected into a dedicated Rollbar project at www.rollbar.com and monitor the health of 9 | your software product/service remotely. 10 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests/RollbarCommonTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import RollbarCommon 3 | 4 | final class RollbarCommonTests: XCTestCase { 5 | 6 | // func testExample() { 7 | // // This is an example of a functional test case. 8 | // // Use XCTAssert and related functions to verify your tests produce the correct 9 | // // results. 10 | // //XCTAssertEqual(RollbarCommon().text, "Hello, World!") 11 | // } 12 | // 13 | // static var allTests = [ 14 | // ("testExample", testExample), 15 | // ] 16 | } 17 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarBundleUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarBundleUtil.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-04-28. 6 | // 7 | 8 | #ifndef RollbarBundleUtil_h 9 | #define RollbarBundleUtil_h 10 | 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface RollbarBundleUtil : NSObject 16 | 17 | + (nonnull NSString *)detectAppBundleVersion; 18 | 19 | #pragma mark - utility 20 | 21 | - (instancetype)init NS_UNAVAILABLE; 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | 27 | #endif //RollbarBundleUtil_h 28 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarBundleUtil.m: -------------------------------------------------------------------------------- 1 | #import "RollbarBundleUtil.h" 2 | 3 | @implementation RollbarBundleUtil 4 | 5 | + (nonnull NSString *)detectAppBundleVersion { 6 | 7 | NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; 8 | if (!infoDictionary) { 9 | return @"n/a"; 10 | } 11 | NSString *major = infoDictionary[@"CFBundleShortVersionString"]; 12 | NSString *minor = infoDictionary[@"CFBundleVersion"]; 13 | NSString *version = [NSString stringWithFormat:@"%@.%@", major, minor]; 14 | return version; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /RollbarNotifier/Tests/RollbarNotifierTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | #if !os(watchOS) 2 | import XCTest 3 | 4 | #if !canImport(ObjectiveC) 5 | public func allTests() -> [XCTestCaseEntry] { 6 | return [ 7 | testCase(RollbarNotifierDTOsTests.allTests), 8 | testCase(RollbarNotifierTelemetryTests.allTests), 9 | testCase(RollbarNotifierConfigurationTests.allTests), 10 | testCase(RollbarNotifierTruncationTests.allTests), 11 | testCase(RollbarNotifierLoggerTests.allTests), 12 | testCase(RolllbarNotifierConfigUtilTests.allTests) 13 | ] 14 | } 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarHostingProcessUtil.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarHostingProcessUtil_h 2 | #define RollbarHostingProcessUtil_h 3 | 4 | #import 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Rollbar utility for getting process related details/attributes 9 | @interface RollbarHostingProcessUtil : NSObject 10 | 11 | /// Returns current process's name 12 | + (NSString *)getHostingProcessName; 13 | 14 | /// Returns current process's ID 15 | + (int)getHostingProcessIdentifier; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | 21 | #endif //RollbarHostingProcessUtil_h 22 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarPersistent.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarPersistent_h 2 | #define RollbarPersistent_h 3 | 4 | @import Foundation; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// A protocol adding support for file-persistence 9 | @protocol RollbarPersistent 10 | 11 | /// Save to a file 12 | /// @param filePath file path to save to 13 | - (BOOL)saveToFile:(NSString *)filePath; 14 | 15 | /// Load object state/data from a file 16 | /// @param filePath file path to load from 17 | - (BOOL)loadFromFile:(NSString *)filePath; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | 23 | #endif //RollbarPersistent_h 24 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import RollbarNotifier 3 | 4 | struct ContentView: View { 5 | var body: some View { 6 | VStack { 7 | Image(systemName: "globe") 8 | .imageScale(.large) 9 | .foregroundColor(.accentColor) 10 | Text("Hello, world!") 11 | } 12 | .padding() 13 | .onAppear { 14 | Rollbar.infoMessage("ContentView Appeared") 15 | } 16 | } 17 | } 18 | 19 | struct ContentView_Previews: PreviewProvider { 20 | static var previews: some View { 21 | ContentView() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/CocoapodsApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import RollbarNotifier 3 | 4 | struct ContentView: View { 5 | var body: some View { 6 | VStack { 7 | Image(systemName: "globe") 8 | .imageScale(.large) 9 | .foregroundColor(.accentColor) 10 | Text("Hello, world!") 11 | } 12 | .padding() 13 | .onAppear { 14 | Rollbar.infoMessage("ContentView Appeared") 15 | } 16 | } 17 | } 18 | 19 | struct ContentView_Previews: PreviewProvider { 20 | static var previews: some View { 21 | ContentView() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarInternalLogging.m: -------------------------------------------------------------------------------- 1 | #import "RollbarInternalLogging.h" 2 | 3 | void RBCLog(NSString *format, ...) { 4 | #ifdef DEBUG 5 | va_list args; 6 | va_start(args, format); 7 | fprintf( 8 | stdout, "[Rollbar] %s\n", 9 | [[[NSString alloc] initWithFormat:format arguments:args] UTF8String]); 10 | va_end(args); 11 | #endif 12 | } 13 | 14 | void RBCErr(NSString *format, ...) { 15 | #ifdef DEBUG 16 | va_list args; 17 | va_start(args, format); 18 | fprintf( 19 | stderr, "[Rollbar] %s\n", 20 | [[[NSString alloc] initWithFormat:format arguments:args] UTF8String]); 21 | va_end(args); 22 | #endif 23 | } 24 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarLog.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarLog_h 2 | #define RollbarLog_h 3 | 4 | @import Foundation; 5 | 6 | /// Rollbar equivalent of NSLog(...) that also allows capture of the log messages as part of RollbarTelemetry data. 7 | /// NOTE: When this SDK is used from Objective-C codebase NSLog(...) messages get captured by the SDK. 8 | /// However, when used from Swift codebase, all the NSLog(...) calls in Swift need to be replaced 9 | /// with similar RollbarLog(...) calls to be captured as extra telemetry data. 10 | /// @param format format of the logged message 11 | void RollbarLog(NSString *format, ...); 12 | 13 | #endif //RollbarLog_h 14 | -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "cocoalumberjack", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git", 7 | "state" : { 8 | "revision" : "0188d31089b5881a269e01777be74c7316924346", 9 | "version" : "3.8.0" 10 | } 11 | }, 12 | { 13 | "identity" : "swift-log", 14 | "kind" : "remoteSourceControl", 15 | "location" : "https://github.com/apple/swift-log.git", 16 | "state" : { 17 | "revision" : "32e8d724467f8fe623624570367e3d50c5638e46", 18 | "version" : "1.5.2" 19 | } 20 | } 21 | ], 22 | "version" : 2 23 | } 24 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/NSDictionary+Rollbar.h: -------------------------------------------------------------------------------- 1 | #ifndef NSDictionary_Rollbar_h 2 | #define NSDictionary_Rollbar_h 3 | 4 | @import Foundation; 5 | 6 | /// Rollbar category for NSDictionary 7 | @interface NSDictionary (Rollbar) 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | /// Checks if a value of the specified class type peresent for the specified key 12 | /// @param key key of interest 13 | /// @param context additional context for descriptive logging 14 | - (BOOL)rollbar_valuePresentForKey:(nonnull NSString *)key 15 | withContext:(nullable NSString *)context; 16 | 17 | NS_ASSUME_NONNULL_END 18 | 19 | @end 20 | 21 | #endif //NSDictionary_Rollbar_h 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "cocoalumberjack", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git", 7 | "state" : { 8 | "revision" : "0188d31089b5881a269e01777be74c7316924346", 9 | "version" : "3.8.0" 10 | } 11 | }, 12 | { 13 | "identity" : "swift-log", 14 | "kind" : "remoteSourceControl", 15 | "location" : "https://github.com/apple/swift-log.git", 16 | "state" : { 17 | "revision" : "32e8d724467f8fe623624570367e3d50c5638e46", 18 | "version" : "1.5.2" 19 | } 20 | } 21 | ], 22 | "version" : 2 23 | } 24 | -------------------------------------------------------------------------------- /RollbarSDK.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "cocoalumberjack", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git", 7 | "state" : { 8 | "revision" : "0188d31089b5881a269e01777be74c7316924346", 9 | "version" : "3.8.0" 10 | } 11 | }, 12 | { 13 | "identity" : "swift-log", 14 | "kind" : "remoteSourceControl", 15 | "location" : "https://github.com/apple/swift-log.git", 16 | "state" : { 17 | "revision" : "32e8d724467f8fe623624570367e3d50c5638e46", 18 | "version" : "1.5.2" 19 | } 20 | } 21 | ], 22 | "version" : 2 23 | } 24 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarRawCrashReport.m: -------------------------------------------------------------------------------- 1 | #import "RollbarRawCrashReport.h" 2 | 3 | static NSString * const DFK_RAW = @"raw"; 4 | 5 | @implementation RollbarRawCrashReport 6 | 7 | #pragma mark - Properties 8 | 9 | - (NSString *)rawCrashReport { 10 | return [self safelyGetStringByKey:DFK_RAW]; 11 | } 12 | 13 | - (void)setRawCrashReport:(NSString *)rawCrashReport { 14 | [self setString:rawCrashReport forKey:DFK_RAW]; 15 | } 16 | 17 | #pragma mark - Initializers 18 | 19 | -(instancetype)initWithRawCrashReport:(nonnull NSString *)rawCrashReport { 20 | 21 | self = [super initWithDictionary:@{ 22 | DFK_RAW:rawCrashReport ? rawCrashReport : [NSNull null] 23 | }]; 24 | return self; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarFileWriter.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarFileWriter.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-05-23. 6 | // 7 | 8 | #ifndef RollbarFileWriter_h 9 | #define RollbarFileWriter_h 10 | 11 | @import Foundation; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface RollbarFileWriter : NSObject 16 | 17 | + (BOOL)ensureFileExists: (nullable NSString *)fileFullPath; 18 | + (void)appendData:(nullable NSData *)data toFile:(nullable NSString *)fileFullPath; 19 | + (void)appendSafelyData:(nullable NSData *)data toFile:(nullable NSString *)fileFullPath; 20 | 21 | /// Hides parameterless initializer. 22 | - (instancetype)init 23 | NS_UNAVAILABLE; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | 29 | #endif //RollbarFileWriter_h 30 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/NSDictionary+Rollbar.m: -------------------------------------------------------------------------------- 1 | #import "NSDictionary+Rollbar.h" 2 | #import "RollbarInternalLogging.h" 3 | 4 | @implementation NSDictionary (Rollbar) 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | - (BOOL)rollbar_valuePresentForKey:(nonnull NSString *)key 9 | withContext:(nullable NSString *)context { 10 | 11 | id value = self[key]; 12 | if (nil != value) { 13 | if ((id)[NSNull null] != value) { 14 | return YES; 15 | } 16 | else { 17 | RBCErr(@"[%@] - key %@ has no value", context, key); 18 | } 19 | } 20 | else { 21 | RBCErr(@"[%@] - key %@ not found", context, key); 22 | } 23 | 24 | return NO; 25 | } 26 | 27 | NS_ASSUME_NONNULL_END 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /RollbarDeploys/Sources/RollbarDeploys/include/RollbarDeploymentDetails.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 Rollbar. All rights reserved. 2 | 3 | #ifndef RollbarDeploymentDetails_h 4 | #define RollbarDeploymentDetails_h 5 | 6 | #import "RollbarDeployment.h" 7 | 8 | @import Foundation; 9 | 10 | /// Models Deployment details 11 | @interface RollbarDeploymentDetails : RollbarDeployment 12 | 13 | /// Deployment ID 14 | @property (readonly, copy) NSString *deployId; 15 | 16 | /// Rollbar project ID 17 | @property (readonly, copy) NSString *projectId; 18 | 19 | /// Start time 20 | @property (readonly, copy) NSDate *startTime; 21 | 22 | /// End time 23 | @property (readonly, copy) NSDate *endTime; 24 | 25 | /// Status 26 | @property (readonly, copy) NSString *status; 27 | 28 | @end 29 | 30 | #endif //RollbarDeploymentDetails_h 31 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFramework/SPMFramework.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import RollbarNotifier 3 | 4 | public struct SPMEntryPoint { 5 | public static func start() { 6 | let config = RollbarConfig.mutableConfig(withAccessToken: "[ACCESSTOKEN]") 7 | config.developerOptions.suppressSdkInfoLogging = false 8 | 9 | Rollbar.initWithConfiguration(config) 10 | } 11 | } 12 | 13 | public struct HelloWorld: View { 14 | private var title: String 15 | 16 | public init(title: String) { 17 | self.title = title 18 | } 19 | 20 | public var body: some View { 21 | VStack { 22 | Text(self.title) 23 | } 24 | .padding() 25 | .onAppear { 26 | Rollbar.infoMessage("SomeView Appeared") 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarRawCrashReport.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarRawCrashReport_h 2 | #define RollbarRawCrashReport_h 3 | 4 | @import RollbarCommon; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Crash report payload element 9 | @interface RollbarRawCrashReport : RollbarDTO 10 | 11 | #pragma mark - Properties 12 | 13 | /// Required: raw crash report content 14 | /// The raw crash report, as a string 15 | /// Rollbar expects the format generated by this SDK 16 | @property (nonatomic, nonnull) NSString *rawCrashReport; 17 | 18 | #pragma mark - Initializers 19 | 20 | /// Initializer 21 | /// @param rawCrashReport raw crash report content 22 | -(instancetype)initWithRawCrashReport:(nonnull NSString *)rawCrashReport; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | 28 | #endif //RollbarRawCrashReport_h 29 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsFramework/CocoapodsFramework/CocoapodsFramework.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import RollbarNotifier 3 | 4 | public struct SPMFramework { 5 | public static func start() { 6 | let config = RollbarConfig.mutableConfig(withAccessToken: "[ACCESSTOKEN]") 7 | config.developerOptions.suppressSdkInfoLogging = false 8 | 9 | Rollbar.initWithConfiguration(config) 10 | } 11 | } 12 | 13 | public struct HelloWorld: View { 14 | private var title: String 15 | 16 | public init(title: String) { 17 | self.title = title 18 | } 19 | 20 | public var body: some View { 21 | VStack { 22 | Text(self.title) 23 | } 24 | .padding() 25 | .onAppear { 26 | Rollbar.infoMessage("SomeView Appeared") 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RollbarAUL/README.md: -------------------------------------------------------------------------------- 1 | # RollbarAUL 2 | 3 | This is an SDK module implements RollbarNotifier integration with Apple Unified Logging (AUL) and allows capture of the AUL entries as corresponding Rollbar Telemetry log events. 4 | 5 | 6 | Main abstractions: 7 | 8 | - RollbarAulStoreMonitor 9 | This component, once enabled, hits the AUL entries store on periodic basis and reads in all the available log entries since the last check that satisfy certain application identifier, category, and log level conditions. It captures these records as Telemetry log events and also reports ones that look like either crash reports, or NSErrors/NSExceptions to Rollbar as corresponding payloads. 10 | 11 | - RollbarAulStoreMonitorOptions 12 | This is an extension to RollbarConfig that allows to specify all the configurational attributes related to Rollbar AUL integration. 13 | 14 | 15 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/NSDate+Rollbar.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Rollbar.m 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-04-27. 6 | // 7 | 8 | #import "NSDate+Rollbar.h" 9 | 10 | @implementation NSDate(Rollbar) 11 | 12 | + (nullable NSDate *)rollbar_dateFromString:(nonnull NSString *)dateString { 13 | 14 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 15 | [formatter setDateFormat:@"YYYY-MM-dd 'at' HH:mm:ss.SSSSSSXX"]; 16 | NSDate *date = [formatter dateFromString:dateString]; 17 | return date; 18 | } 19 | 20 | - (nonnull NSString *)rollbar_toString { 21 | 22 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 23 | [formatter setDateFormat:@"YYYY-MM-dd 'at' HH:mm:ss.SSSSSSXX"]; 24 | NSString *dateString = [formatter stringFromDate:self]; 25 | return dateString; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsApp/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - RollbarCommon (3.3.2) 3 | - RollbarCrash (3.3.2) 4 | - RollbarNotifier (3.3.2): 5 | - RollbarCommon (~> 3.3.2) 6 | - RollbarCrash (~> 3.3.2) 7 | - RollbarReport (~> 3.3.2) 8 | - RollbarReport (3.3.2): 9 | - RollbarCrash (~> 3.3.2) 10 | 11 | DEPENDENCIES: 12 | - RollbarNotifier (~> 3.3.2) 13 | 14 | SPEC REPOS: 15 | trunk: 16 | - RollbarCommon 17 | - RollbarCrash 18 | - RollbarNotifier 19 | - RollbarReport 20 | 21 | SPEC CHECKSUMS: 22 | RollbarCommon: ebcc821a01d12aa29b66b204da041b95e99dfcce 23 | RollbarCrash: 1069c64976ae36b42c45187c977115d07a6f6667 24 | RollbarNotifier: e4c4d5c945489af69e063bf6b1aba4990136a7f6 25 | RollbarReport: 6008c84d712bffb3cea026d04c284ce568ec7c27 26 | 27 | PODFILE CHECKSUM: d3d7827ecef6fee3336ada7cb21253c0d8a7a0b5 28 | 29 | COCOAPODS: 1.15.2 30 | -------------------------------------------------------------------------------- /Examples/Integration/CocoapodsFramework/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - RollbarCommon (3.3.2) 3 | - RollbarCrash (3.3.2) 4 | - RollbarNotifier (3.3.2): 5 | - RollbarCommon (~> 3.3.2) 6 | - RollbarCrash (~> 3.3.2) 7 | - RollbarReport (~> 3.3.2) 8 | - RollbarReport (3.3.2): 9 | - RollbarCrash (~> 3.3.2) 10 | 11 | DEPENDENCIES: 12 | - RollbarNotifier (~> 3.3.2) 13 | 14 | SPEC REPOS: 15 | trunk: 16 | - RollbarCommon 17 | - RollbarCrash 18 | - RollbarNotifier 19 | - RollbarReport 20 | 21 | SPEC CHECKSUMS: 22 | RollbarCommon: ebcc821a01d12aa29b66b204da041b95e99dfcce 23 | RollbarCrash: 1069c64976ae36b42c45187c977115d07a6f6667 24 | RollbarNotifier: e4c4d5c945489af69e063bf6b1aba4990136a7f6 25 | RollbarReport: 6008c84d712bffb3cea026d04c284ce568ec7c27 26 | 27 | PODFILE CHECKSUM: 7d733706898117d1f54dc3581d72138e1765dcfc 28 | 29 | COCOAPODS: 1.15.2 30 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/DesignPatterns/Creational/RollbarBuilder.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @class RollbarEntityBuilder; 6 | 7 | ///Immutable entity model 8 | @interface RollbarEntity : NSObject 9 | 10 | /// Entity ID 11 | @property (nonnull, nonatomic, readonly) NSString *ID; 12 | 13 | /// Designated initializer 14 | /// @param builder an entity builder 15 | - (nonnull instancetype)initWithBuilder:(nonnull RollbarEntityBuilder *)builder 16 | NS_DESIGNATED_INITIALIZER; 17 | 18 | /// Hides the method. 19 | - (instancetype)init 20 | NS_UNAVAILABLE; 21 | 22 | @end 23 | 24 | /// Mutable builder of immutable entities 25 | @interface RollbarEntityBuilder : NSObject 26 | 27 | /// Entity ID 28 | @property (nonnull, nonatomic) NSString *ID; 29 | 30 | /// The builder method. 31 | - (nonnull RollbarEntity *)build; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarSource.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarSource_h 2 | #define RollbarSource_h 3 | 4 | @import Foundation; 5 | 6 | #pragma mark - RollbarSource enum 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarSource) { 9 | RollbarSource_Client, 10 | RollbarSource_Server, 11 | }; 12 | 13 | #pragma mark - RollbarSourceUtil 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /// RollbarSource conversion utility 18 | @interface RollbarSourceUtil : NSObject 19 | 20 | /// Convert RollbarSource to a string 21 | /// @param value RollbarSource value 22 | + (NSString *) RollbarSourceToString:(RollbarSource)value; 23 | 24 | /// Convert RollbarSource value from a string 25 | /// @param value string representation of a RollbarSource value 26 | + (RollbarSource) RollbarSourceFromString:(nullable NSString *)value; 27 | 28 | @end 29 | 30 | NS_ASSUME_NONNULL_END 31 | 32 | #endif //RollbarSource_h 33 | -------------------------------------------------------------------------------- /UnitTesting/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.7.1 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "UnitTesting", 7 | platforms: [ 8 | .macOS(.v10_13), 9 | .iOS(.v11), 10 | .tvOS(.v11), 11 | .watchOS(.v4), 12 | ], 13 | products: [ 14 | .library( 15 | name: "UnitTesting", 16 | targets: ["UnitTesting"]), 17 | ], 18 | dependencies: [ 19 | .package(path: "../RollbarCommon"), 20 | ], 21 | targets: [ 22 | .target( 23 | name: "UnitTesting", 24 | dependencies: ["RollbarCommon"], 25 | path: "Sources/UnitTesting" 26 | ), 27 | .testTarget( 28 | name: "UnitTestingTests", 29 | dependencies: ["UnitTesting"] 30 | ), 31 | ], 32 | swiftLanguageVersions: [ 33 | SwiftVersion.v5, 34 | ] 35 | ) 36 | -------------------------------------------------------------------------------- /RollbarNotifier/Tests/RollbarNotifierTests-ObjC/XCTestCase+RollbarNotifierTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // XCTestCase+RollbarNotifierTest.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-15. 6 | // 7 | 8 | #import 9 | 10 | @class RollbarMutableConfig; 11 | @class RollbarPayloadFactory; 12 | @class RollbarPayload; 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface XCTestCase (RollbarNotifierTest) 17 | 18 | - (nonnull RollbarPayloadFactory *)getPayloadFactory_Live_Default; 19 | 20 | - (nonnull RollbarMutableConfig*) getConfig_Live_Default; 21 | 22 | - (nonnull NSString *)getCrashReportMock; 23 | - (nonnull NSString *)getMessageMock; 24 | 25 | - (nonnull RollbarPayload *)getPayload_CrashReport; 26 | - (nonnull RollbarPayload *)getPayload_Message; 27 | - (nonnull RollbarPayload *)getPayload_Error; 28 | - (nonnull RollbarPayload *)getPayload_Exception; 29 | 30 | @end 31 | 32 | NS_ASSUME_NONNULL_END 33 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarOsUtil.m: -------------------------------------------------------------------------------- 1 | #import "RollbarOsUtil.h" 2 | 3 | @implementation RollbarOsUtil 4 | 5 | + (NSOperatingSystemVersion)detectOsVersion { 6 | 7 | NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; 8 | return version; 9 | } 10 | 11 | + (nonnull NSString *)detectOsVersionString { 12 | 13 | NSString *result = [[NSProcessInfo processInfo] operatingSystemVersionString]; 14 | return result; 15 | } 16 | 17 | + (nonnull NSString *)stringFromOsVersion:(NSOperatingSystemVersion)version { 18 | 19 | NSString *versionString = 20 | [NSString stringWithFormat:@"%@.%@.%@", @(version.majorVersion), @(version.minorVersion), @(version.patchVersion)]; 21 | return versionString; 22 | } 23 | 24 | + (NSTimeInterval)detectOsUptimeInterval { 25 | 26 | NSTimeInterval result = [[NSProcessInfo processInfo] systemUptime]; 27 | return result; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | @import RollbarNotifier; 4 | 5 | @implementation AppDelegate 6 | 7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | // Rollbar Configuration object. 9 | RollbarMutableConfig *config = [ 10 | // Rollbar post_client_item access token 11 | RollbarConfig mutableConfigWithAccessToken:@"YOUR-ROLLBAR-ACCESSTOKEN" 12 | environment:@"staging"]; 13 | 14 | config.loggingOptions.codeVersion = @"main"; 15 | config.developerOptions.suppressSdkInfoLogging = NO; 16 | config.telemetry.memoryStatsAutocollectionInterval = 0.5; 17 | config.telemetry.enabled = YES; 18 | 19 | [Rollbar initWithConfiguration:config]; 20 | 21 | [Rollbar infoMessage:@"Rollbar is up and running! Enjoy your remote error and log monitoring..."]; 22 | 23 | return YES; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarInternalLogging.m: -------------------------------------------------------------------------------- 1 | #import "RollbarInternalLogging.h" 2 | #import "RollbarInfrastructure.h" 3 | 4 | void RBLog(NSString *format, ...) { 5 | #ifdef DEBUG 6 | if (RollbarInfrastructure.sharedInstance.configuration.developerOptions.suppressSdkInfoLogging) { 7 | return; 8 | } 9 | 10 | va_list args; 11 | va_start(args, format); 12 | fprintf(stdout, "[Rollbar] %s\n", 13 | [[[NSString alloc] initWithFormat:format arguments:args] UTF8String]); 14 | va_end(args); 15 | #endif 16 | } 17 | 18 | void RBErr(NSString *format, ...) { 19 | #ifdef DEBUG 20 | if (RollbarInfrastructure.sharedInstance.configuration.developerOptions.suppressSdkInfoLogging) { 21 | return; 22 | } 23 | 24 | va_list args; 25 | va_start(args, format); 26 | fprintf(stderr, "[Rollbar] %s\n", 27 | [[[NSString alloc] initWithFormat:format arguments:args] UTF8String]); 28 | va_end(args); 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarRegistry.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarRegistry.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-28. 6 | // 7 | 8 | #import 9 | 10 | #import "RollbarDestinationRecord.h" 11 | #import "RollbarConfig.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface RollbarRegistry : NSObject 16 | 17 | - (nonnull RollbarDestinationRecord *)getRecordForConfig:(nonnull RollbarConfig *)config; 18 | - (nonnull RollbarDestinationRecord *)getRecordForEndpoint:(nonnull NSString *)endpoint 19 | andAccessToken:(nonnull NSString *)accessToken; 20 | - (NSUInteger)totalDestinationRecords; 21 | 22 | + (nonnull NSString *)destinationID:(nonnull RollbarDestination *)destination; 23 | + (nonnull NSString *)destinationIDwithEndpoint:(nonnull NSString *)endpoint 24 | andAccessToken:(nonnull NSString *)accessToken; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarMessage.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarMessage_h 2 | #define RollbarMessage_h 3 | 4 | @import RollbarCommon; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Message element of a payload 9 | /// @note: 10 | /// Can also contain any arbitrary keys of metadata. Their values can be any valid JSON. 11 | /// For example: 12 | /// "route": "home#index", 13 | /// "time_elapsed": 15.23 14 | @interface RollbarMessage : RollbarDTO 15 | 16 | /// Required: body 17 | /// The primary message text, as a string 18 | @property (nonatomic, copy, nonnull) NSString *body; 19 | 20 | 21 | #pragma mark - Initializers 22 | 23 | /// Initializer 24 | /// @param messageBody message content 25 | -(instancetype)initWithBody:(nonnull NSString *)messageBody; 26 | 27 | /// Initializer 28 | /// @param error an error to use as the message content 29 | -(instancetype)initWithNSError:(nonnull NSError *)error; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | 35 | #endif //RollbarMessage_h 36 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarOsUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarOsUtil.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-04-28. 6 | // 7 | 8 | #ifndef RollbarOsUtil_h 9 | #define RollbarOsUtil_h 10 | 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface RollbarOsUtil : NSObject 16 | 17 | + (nonnull NSString *)detectOsVersionString; 18 | + (NSOperatingSystemVersion)detectOsVersion; 19 | 20 | + (nonnull NSString *)stringFromOsVersion:(NSOperatingSystemVersion)version; 21 | 22 | + (NSTimeInterval)detectOsUptimeInterval; 23 | 24 | #pragma mark - static utility nature 25 | 26 | + (instancetype)new NS_UNAVAILABLE; 27 | + (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 28 | + (instancetype)alloc NS_UNAVAILABLE; 29 | + (id)copyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 30 | + (id)mutableCopyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | 36 | #endif //RollbarOsUtil_h 37 | -------------------------------------------------------------------------------- /RollbarAUL/Sources/RollbarAUL/include/RollbarAulEntrySnapper.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarAulEntrySnapper_h 2 | #define RollbarAulEntrySnapper_h 3 | 4 | @import Foundation; 5 | 6 | #if TARGET_OS_OSX 7 | 8 | //@import OSLog; 9 | #if __has_include() 10 | #include 11 | #endif 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | API_AVAILABLE(macos(10.15)) 16 | API_UNAVAILABLE(ios, tvos, watchos) 17 | /// Rollbar class for capturing AUL entries as NSDictionaries 18 | @interface RollbarAulEntrySnapper : NSObject 19 | 20 | /// Captures an OSLogEntry 21 | /// @param entry an OSLogEntry 22 | /// @param snapshot a disctionary for capturing the snapshots 23 | - (void)captureOSLogEntry:(nullable OSLogEntry *)entry 24 | intoSnapshot:(nonnull NSMutableDictionary *)snapshot 25 | API_AVAILABLE(macos(10.15)) 26 | API_UNAVAILABLE(ios, tvos, watchos) 27 | ; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | 33 | #endif //RollbarAulEntrySnapper_h 34 | 35 | #endif //TARGET_OS_OSX 36 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarTriStateFlag.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTriStateFlag_h 2 | #define RollbarTriStateFlag_h 3 | 4 | @import Foundation; 5 | 6 | #pragma mark - RollbarTriStateFlag enum 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarTriStateFlag) { 9 | RollbarTriStateFlag_None, 10 | RollbarTriStateFlag_On, 11 | RollbarTriStateFlag_Off, 12 | }; 13 | 14 | #pragma mark - RollbarTriStateFlagUtil 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | /// Utility class aiding with TriStateFlag conversions 19 | @interface RollbarTriStateFlagUtil : NSObject 20 | 21 | /// Convert TriStateFlag to a string 22 | /// @param value TriStateFlag value 23 | + (nonnull NSString *)TriStateFlagToString:(RollbarTriStateFlag)value; 24 | 25 | /// Convert TriStateFlag value from a string 26 | /// @param value string representation of a TriStateFlag value 27 | + (RollbarTriStateFlag)TriStateFlagFromString:(nullable NSString *)value; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | 33 | #endif //RollbarTriStateFlag_h 34 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarAppLanguage.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarAppLanguage_h 2 | #define RollbarAppLanguage_h 3 | 4 | @import Foundation; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarAppLanguage) { 9 | RollbarAppLanguage_ObjectiveC, 10 | RollbarAppLanguage_ObjectiveCpp, 11 | RollbarAppLanguage_Swift, 12 | RollbarAppLanguage_C, 13 | RollbarAppLanguage_Cpp, 14 | }; 15 | 16 | /// Utility class aiding with RollbarAppLanguage conversions 17 | @interface RollbarAppLanguageUtil : NSObject 18 | 19 | /// Convert RollbarAppLanguage to a string 20 | /// @param value RollbarAppLanguage value 21 | + (NSString *) RollbarAppLanguageToString:(RollbarAppLanguage)value; 22 | 23 | /// Convert RollbarAppLanguage value from a string 24 | /// @param value string representation of a RollbarAppLanguage value 25 | + (RollbarAppLanguage) RollbarAppLanguageFromString:(NSString *)value; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | 31 | #endif //RollbarAppLanguage_h 32 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarLevel.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarLevel_h 2 | #define RollbarLevel_h 3 | 4 | @import Foundation; 5 | 6 | #pragma mark - RollbarLevel 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarLevel) { 9 | RollbarLevel_Debug, 10 | RollbarLevel_Info, 11 | RollbarLevel_Warning, 12 | RollbarLevel_Error, 13 | RollbarLevel_Critical 14 | }; 15 | 16 | #pragma mark - RollbarLevel utility 17 | 18 | NS_ASSUME_NONNULL_BEGIN 19 | 20 | /// RollbarLevel utility 21 | @interface RollbarLevelUtil : NSObject 22 | 23 | /// Converts RollbarLevel enum value to its string equivalent or default string. 24 | /// @param value RollbarLevel enum value 25 | + (NSString *)rollbarLevelToString:(RollbarLevel)value; 26 | 27 | /// Converts string value into its RollbarLevel enum value equivalent or default enum value. 28 | /// @param value input string 29 | + (RollbarLevel)rollbarLevelFromString:(nullable NSString *)value; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | 35 | #endif //RollbarLevel_h 36 | -------------------------------------------------------------------------------- /RollbarCommon/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.7.1 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RollbarCommon", 7 | platforms: [ 8 | .macOS(.v10_13), 9 | .iOS(.v11), 10 | .tvOS(.v11), 11 | .watchOS(.v4), 12 | ], 13 | products: [ 14 | .library(name: "RollbarCommon", targets: ["RollbarCommon"]), 15 | ], 16 | targets: [ 17 | .target( 18 | name: "RollbarCommon", 19 | path: "Sources/RollbarCommon" 20 | ), 21 | .testTarget( 22 | name: "RollbarCommonTests", 23 | dependencies: ["RollbarCommon"] 24 | ), 25 | .testTarget( 26 | name: "RollbarCommonTests-ObjC", 27 | dependencies: ["RollbarCommon"], 28 | path: "Tests/RollbarCommonTests-ObjC", 29 | exclude: ["TestData/rollbar-crash-report-147120812218-raw.txt"] 30 | ) 31 | ], 32 | swiftLanguageVersions: [ 33 | SwiftVersion.v5, 34 | ] 35 | ) 36 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarSource.m: -------------------------------------------------------------------------------- 1 | #import "RollbarSource.h" 2 | 3 | @implementation RollbarSourceUtil 4 | 5 | + (NSString *) RollbarSourceToString:(RollbarSource)value { 6 | 7 | switch (value) { 8 | case RollbarSource_Client: 9 | return @"client"; 10 | case RollbarSource_Server: 11 | return @"server"; 12 | default: 13 | return @"UNKNOWN"; 14 | } 15 | } 16 | 17 | + (RollbarSource) RollbarSourceFromString:(nullable NSString *)value { 18 | 19 | if (nil == value) { 20 | 21 | return RollbarSource_Server; // default case... 22 | } 23 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"client"]) { 24 | 25 | return RollbarSource_Client; 26 | } 27 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"server"]) { 28 | 29 | return RollbarSource_Server; 30 | } 31 | else { 32 | 33 | return RollbarSource_Server; // default case... 34 | } 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarTriStateFlag.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTriStateFlag.h" 2 | 3 | @implementation RollbarTriStateFlagUtil 4 | 5 | + (NSString *) TriStateFlagToString:(RollbarTriStateFlag)value { 6 | 7 | switch (value) { 8 | case RollbarTriStateFlag_On: 9 | return @"ON"; 10 | case RollbarTriStateFlag_Off: 11 | return @"OFF"; 12 | case RollbarTriStateFlag_None: 13 | default: 14 | return @"NONE"; 15 | } 16 | } 17 | 18 | + (RollbarTriStateFlag) TriStateFlagFromString:(NSString *)value { 19 | 20 | if (nil == value) { 21 | return RollbarTriStateFlag_None; 22 | } 23 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"ON"]) { 24 | return RollbarTriStateFlag_On; 25 | } 26 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"OFF"]) { 27 | return RollbarTriStateFlag_Off; 28 | } 29 | else { 30 | return RollbarTriStateFlag_None; // default case... 31 | } 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarCaptureIpType.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarCaptureIpType_h 2 | #define RollbarCaptureIpType_h 3 | 4 | @import Foundation; 5 | 6 | #pragma mark - RollbarCaptureIpType enum 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarCaptureIpType) { 9 | RollbarCaptureIpType_Full, 10 | RollbarCaptureIpType_Anonymize, 11 | RollbarCaptureIpType_None 12 | }; 13 | 14 | #pragma mark - CaptureIpTypeUtil 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | /// Utility class aiding with CaptureIpType conversions 19 | @interface RollbarCaptureIpTypeUtil : NSObject 20 | 21 | /// Convert CaptureIpType to a string 22 | /// @param value RollbarCaptureIpType value 23 | + (NSString *) CaptureIpTypeToString:(RollbarCaptureIpType)value; 24 | 25 | /// Convert CaptureIpType value from a string 26 | /// @param value string representation of a RollbarCaptureIpType value 27 | + (RollbarCaptureIpType) CaptureIpTypeFromString:(NSString *)value; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | 33 | #endif //RollbarCaptureIpType_h 34 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarCachesDirectory.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarCachesDirectory_h 2 | #define RollbarCachesDirectory_h 3 | 4 | @import Foundation; 5 | 6 | /// Rollbar cache directory utility. 7 | @interface RollbarCachesDirectory : NSObject 8 | 9 | /// Path to the cache directory. 10 | + (nonnull NSString *)directory; 11 | 12 | /// Ensures that the expected caches directory does exist, otherwise returns NO. 13 | + (BOOL)ensureCachesDirectoryExists; 14 | 15 | /// Returns YES if the specified file exists in the cache directory, otherwise returns NO. 16 | /// @param fileName file to check for. 17 | + (BOOL)checkCacheFileExists:(nonnull NSString *)fileName; 18 | 19 | /// Returns full path + file name to the specified cache file 20 | /// @param fileName file name of a cache 21 | + (nonnull NSString *)getCacheFilePath:(nonnull NSString *)fileName; 22 | 23 | #pragma mark - Initializers 24 | 25 | /// Hides parameterless initializer. 26 | - (nonnull instancetype)init 27 | NS_UNAVAILABLE; 28 | 29 | @end 30 | 31 | #endif // RollbarCachesDirectory_h 32 | -------------------------------------------------------------------------------- /Examples/Integration/SPMFramework/SPMFramework.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "cocoalumberjack", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git", 7 | "state" : { 8 | "revision" : "0188d31089b5881a269e01777be74c7316924346", 9 | "version" : "3.8.0" 10 | } 11 | }, 12 | { 13 | "identity" : "rollbar-apple", 14 | "kind" : "remoteSourceControl", 15 | "location" : "git@github.com:rollbar/rollbar-apple.git", 16 | "state" : { 17 | "revision" : "37b6481208eade23be9cb61bc53b3fb8884d4de2", 18 | "version" : "3.1.0" 19 | } 20 | }, 21 | { 22 | "identity" : "swift-log", 23 | "kind" : "remoteSourceControl", 24 | "location" : "https://github.com/apple/swift-log.git", 25 | "state" : { 26 | "revision" : "32e8d724467f8fe623624570367e3d50c5638e46", 27 | "version" : "1.5.2" 28 | } 29 | } 30 | ], 31 | "version" : 2 32 | } 33 | -------------------------------------------------------------------------------- /Examples/Integration/SPMApp/SPMApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "cocoalumberjack", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git", 7 | "state" : { 8 | "revision" : "0188d31089b5881a269e01777be74c7316924346", 9 | "version" : "3.8.0" 10 | } 11 | }, 12 | { 13 | "identity" : "rollbar-apple", 14 | "kind" : "remoteSourceControl", 15 | "location" : "git@github.com:rollbar/rollbar-apple.git", 16 | "state" : { 17 | "revision" : "37b6481208eade23be9cb61bc53b3fb8884d4de2", 18 | "version" : "3.1.0" 19 | } 20 | }, 21 | { 22 | "identity" : "swift-log", 23 | "kind" : "remoteSourceControl", 24 | "location" : "https://github.com/apple/swift-log.git", 25 | "state" : { 26 | "revision" : "32e8d724467f8fe623624570367e3d50c5638e46", 27 | "version" : "1.5.2" 28 | } 29 | } 30 | ], 31 | "version" : 2 32 | } 33 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarCallStackFrameContext.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarCallStackFrameContext_h 2 | #define RollbarCallStackFrameContext_h 3 | 4 | @import RollbarCommon; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// RollbarCallStackFrameContext payload element 9 | @interface RollbarCallStackFrameContext : RollbarDTO 10 | 11 | #pragma mark - Properties 12 | 13 | /// Optional: pre 14 | /// List of lines of code before the "code" line 15 | @property (nonatomic, nullable) NSArray *preCodeLines; 16 | 17 | /// Optional: post 18 | /// List of lines of code after the "code" line 19 | @property (nonatomic, nullable) NSArray *postCodeLines; 20 | 21 | #pragma mark - Initializers 22 | 23 | /// Initializer 24 | /// @param pre preceding lines of code 25 | /// @param post post/trailing lines of code 26 | -(instancetype)initWithPreCodeLines:(nullable NSArray *)pre 27 | postCodeLines:(nullable NSArray *)post; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | 33 | #endif //RollbarCallStackFrameContext_h 34 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests-ObjC/RollbarBundleUtilTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import RollbarCommon; 4 | 5 | @interface RollbarBundleUtilTests : XCTestCase 6 | 7 | @end 8 | 9 | @implementation RollbarBundleUtilTests 10 | 11 | - (void)setUp { 12 | // Put setup code here. This method is called before the invocation of each test method in the class. 13 | } 14 | 15 | - (void)tearDown { 16 | // Put teardown code here. This method is called after the invocation of each test method in the class. 17 | } 18 | 19 | - (void)testDetectAppBundleVersion { 20 | 21 | NSString *version = [RollbarBundleUtil detectAppBundleVersion]; 22 | XCTAssertNotNil(version); 23 | XCTAssertGreaterThan(version.length, 0); 24 | XCTAssertGreaterThanOrEqual([version componentsSeparatedByString:@"."].count, 3); 25 | } 26 | 27 | - (void)testPerformanceDetectAppBundleVersion { 28 | // This is an example of a performance test case. 29 | [self measureBlock:^{ 30 | 31 | NSString *version = [RollbarBundleUtil detectAppBundleVersion]; 32 | }]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /RollbarAUL/Sources/RollbarAUL/include/RollbarAulLogLevelConverter.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarAulLogLevelConverter_h 2 | #define RollbarAulLogLevelConverter_h 3 | 4 | @import Foundation; 5 | 6 | #if TARGET_OS_OSX 7 | 8 | @import RollbarNotifier; 9 | 10 | #if __has_include() 11 | #include 12 | #endif 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0)) 17 | /// Rollbar level to/from AUL log type converter 18 | @interface RollbarAulLogLevelConverter : NSObject 19 | 20 | /// Converts a Rollbar log level to a AulLevel 21 | /// @param value a Rollbar log level 22 | + (os_log_type_t) RollbarLevelToAulLevel:(RollbarLevel)value 23 | API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0)) 24 | ; 25 | 26 | /// Converts an AulLevel to a Rollbar log level 27 | /// @param value an AulLevel 28 | + (RollbarLevel) RollbarLevelFromAulLevel:(os_log_type_t)value 29 | API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0)) 30 | ; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | 36 | #endif //RollbarAulLogLevelConverter_h 37 | 38 | #endif //TARGET_OS_OSX 39 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests-ObjC/Mocks/Calculator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Calculator.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2020-10-13. 6 | // 7 | 8 | 9 | #import 10 | @import Foundation; 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | typedef NS_ENUM(NSUInteger, CalculatorOperation) { 15 | CalculatorOperation_Add, 16 | CalculatorOperation_Subtract, 17 | CalculatorOperation_Multiply, 18 | CalculatorOperation_Divide, 19 | }; 20 | 21 | @interface Calculator : NSObject { 22 | @private 23 | XCTestExpectation *_expectation; 24 | } 25 | 26 | @property (readonly) NSInteger operand1; 27 | @property (readonly) NSInteger operand2; 28 | @property (readonly) CalculatorOperation operation; 29 | 30 | -(NSInteger)calculate; 31 | 32 | -(instancetype)init NS_UNAVAILABLE; 33 | 34 | -(instancetype)initWithOperation:(CalculatorOperation)operation 35 | operand1:(NSInteger)operand1 36 | operand2:(NSInteger)operand2 37 | expectation:(XCTestExpectation *)expectation 38 | NS_DESIGNATED_INITIALIZER; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarInfrastructure.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarInfrastructure_h 2 | #define RollbarInfrastructure_h 3 | 4 | #import 5 | #import "RollbarLoggerProtocol.h" 6 | #import "RollbarConfig.h" 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | @interface RollbarInfrastructure : NSObject 11 | 12 | @property (readonly, strong) RollbarConfig *configuration; 13 | @property (readonly, strong) id logger; 14 | 15 | - (instancetype)configureWith:(RollbarConfig *)config; 16 | 17 | #pragma mark - Sigleton pattern 18 | 19 | + (instancetype)sharedInstance; 20 | 21 | + (instancetype)new NS_UNAVAILABLE; 22 | + (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 23 | + (instancetype)alloc NS_UNAVAILABLE; 24 | + (id)copyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 25 | + (id)mutableCopyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 26 | 27 | - (instancetype)init NS_UNAVAILABLE; 28 | - (void)dealloc NS_UNAVAILABLE; 29 | - (id)copy NS_UNAVAILABLE; 30 | - (id)mutableCopy NS_UNAVAILABLE; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | 36 | #endif //RollbarInfrastructure_h 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Rollbar, Inc. 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarPayload.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarPayload_h 2 | #define RollbarPayload_h 3 | 4 | @import RollbarCommon; 5 | 6 | @class RollbarData; 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | /// The payload root model 11 | @interface RollbarPayload : RollbarDTO 12 | 13 | #pragma mark - properties 14 | 15 | /// Required: access_token 16 | /// An access token with scope "post_server_item" or "post_client_item". 17 | /// A post_client_item token must be used if the "platform" is "browser", "android", "ios", "flash", or "client" 18 | /// A post_server_item token should be used for other platforms. 19 | @property (nonatomic, copy, nonnull) NSString *accessToken; 20 | 21 | /// Required: data 22 | @property (nonatomic, nonnull) RollbarData *data; 23 | 24 | #pragma mark - initializers 25 | 26 | /// Initializer 27 | /// @param token Rollbar project access token 28 | /// @param data data element of the payload 29 | -(instancetype)initWithAccessToken:(nonnull NSString *)token 30 | data:(nonnull RollbarData *)data; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | 36 | #endif //RollbarPayload_h 37 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarCaptureIpType.m: -------------------------------------------------------------------------------- 1 | #import "RollbarCaptureIpType.h" 2 | 3 | @implementation RollbarCaptureIpTypeUtil 4 | 5 | + (NSString *) CaptureIpTypeToString:(RollbarCaptureIpType)value { 6 | switch (value) { 7 | case RollbarCaptureIpType_Full: 8 | return @"Full"; 9 | case RollbarCaptureIpType_Anonymize: 10 | return @"Anonymize"; 11 | case RollbarCaptureIpType_None: 12 | return @"None"; 13 | default: 14 | return @"None"; 15 | } 16 | } 17 | 18 | + (RollbarCaptureIpType) CaptureIpTypeFromString:(NSString *)value { 19 | if (NSOrderedSame == [value caseInsensitiveCompare:@"Full"]) { 20 | return RollbarCaptureIpType_Full; 21 | } 22 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"Anonymize"]) { 23 | return RollbarCaptureIpType_Anonymize; 24 | } 25 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"None"]) { 26 | return RollbarCaptureIpType_None; 27 | } 28 | else { 29 | return RollbarCaptureIpType_None; // default case... 30 | } 31 | 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarNotifierFiles.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarNotifierFiles.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-06. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface RollbarNotifierFiles : NSObject 13 | 14 | #pragma mark - notifier files 15 | 16 | + (nonnull NSString * const)payloadsStore; 17 | 18 | + (nonnull NSString * const)telemetryQueue; 19 | 20 | + (nonnull NSString * const)runtimeSession; 21 | 22 | + (nonnull NSString * const)appQuit; 23 | 24 | + (nonnull NSString * const)incomingPayloadsLog; 25 | 26 | + (nonnull NSString * const)transmittedPayloadsLog; 27 | 28 | + (nonnull NSString * const)droppedPayloadsLog; 29 | 30 | + (nonnull NSString * const)config; 31 | 32 | #pragma mark - static utility nature 33 | 34 | + (instancetype)new NS_UNAVAILABLE; 35 | + (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 36 | + (instancetype)alloc NS_UNAVAILABLE; 37 | + (id)copyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 38 | + (id)mutableCopyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /RollbarDeploys/Sources/RollbarDeploys/include/RollbarDeployApiCallOutcome.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarDeployApiCallOutcome.h 3 | // Rollbar 4 | // 5 | // Created by Andrey Kornich on 2019-11-08. 6 | // Copyright © 2019 Rollbar. All rights reserved. 7 | // 8 | 9 | #ifndef RollbarDeployApiCallOutcome_h 10 | #define RollbarDeployApiCallOutcome_h 11 | 12 | @import Foundation; 13 | 14 | typedef NS_ENUM(NSInteger, RollbarDeployApiCallOutcome) { 15 | RollbarDeployApiCall_Success, 16 | RollbarDeployApiCall_Error, 17 | }; 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | 21 | /// Enum to/from NSString conversion utility 22 | @interface RollbarDeployApiCallOutcomeUtil : NSObject 23 | 24 | /// Converts RollbarDeployApiCallOutcome value into a NSString 25 | /// @param value DeployApiCallOutcome value to convert 26 | + (NSString *) DeployApiCallOutcomeToString:(RollbarDeployApiCallOutcome)value; 27 | 28 | /// Converts NSString into a RollbarDeployApiCallOutcome value 29 | /// @param value NSString to convert 30 | + (RollbarDeployApiCallOutcome) DeployApiCallOutcomeFromString:(NSString *)value; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | 36 | #endif //RollbarDeployApiCallOutcome_h 37 | -------------------------------------------------------------------------------- /RollbarDeploys/Sources/RollbarDeploys/DTOs/DeployApiCallOutcome.m: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarDeployApiCallOutcome.m 3 | // Rollbar 4 | // 5 | // Created by Andrey Kornich on 2019-11-08. 6 | // Copyright © 2019 Rollbar. All rights reserved. 7 | // 8 | 9 | #import "RollbarDeployApiCallOutcome.h" 10 | 11 | @implementation RollbarDeployApiCallOutcomeUtil 12 | 13 | + (NSString *) DeployApiCallOutcomeToString:(RollbarDeployApiCallOutcome)value; { 14 | switch (value) { 15 | case RollbarDeployApiCall_Success: 16 | return @"success"; 17 | case RollbarDeployApiCall_Error: 18 | return @"error"; 19 | default: 20 | return @"unknown"; 21 | } 22 | } 23 | 24 | + (RollbarDeployApiCallOutcome) DeployApiCallOutcomeFromString:(NSString *)value { 25 | 26 | if (NSOrderedSame == [value caseInsensitiveCompare:@"success"]) { 27 | return RollbarDeployApiCall_Success; 28 | } 29 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"error"]) { 30 | return RollbarDeployApiCall_Error; 31 | } 32 | else { 33 | return RollbarDeployApiCall_Error; // default case... 34 | } 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarTelemetryOptionsObserver.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | @class RollbarTelemetryOptions; 4 | 5 | /// Telemetry options observer 6 | @interface RollbarTelemetryOptionsObserver : NSObject 7 | 8 | /// Registers with a Telemetry options object to observe its changes. 9 | /// @param telemetryOptions the Telemetry options object. 10 | - (void)registerAsObserverForTelemetryOptions:(RollbarTelemetryOptions *)telemetryOptions; 11 | 12 | /// Unregisters from observing Telemetry options object changes. 13 | /// @param telemetryOptions the Telemetry options object. 14 | - (void)unregisterAsObserverForTelemetryOptions:(RollbarTelemetryOptions *)telemetryOptions; 15 | 16 | /// Callback invoked when any keyed value of an observed object changes. 17 | /// @param keyPath the key path of the change 18 | /// @param object the observed object 19 | /// @param change the observed change 20 | /// @param context an extra context for the change 21 | - (void)observeValueForKeyPath:(NSString *)keyPath 22 | ofObject:(id)object 23 | change:(NSDictionary *)change 24 | context:(void *)context; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests-ObjC/RollbarHostingProcessUtilTest.m: -------------------------------------------------------------------------------- 1 | #import 2 | @import RollbarCommon; 3 | 4 | @interface RollbarHostingProcessUtilTest : XCTestCase 5 | 6 | @end 7 | 8 | @implementation RollbarHostingProcessUtilTest 9 | 10 | - (void)setUp { 11 | // Put setup code here. This method is called before the invocation of each test method in the class. 12 | } 13 | 14 | - (void)tearDown { 15 | // Put teardown code here. This method is called after the invocation of each test method in the class. 16 | } 17 | 18 | - (void)testGetHostingProcessName { 19 | 20 | NSString *name = [RollbarHostingProcessUtil getHostingProcessName]; 21 | XCTAssertTrue([name isEqualToString:@"xctest"]); 22 | } 23 | 24 | - (void)testGetHostingProcessIdentifier { 25 | 26 | int identifier = [RollbarHostingProcessUtil getHostingProcessIdentifier]; 27 | XCTAssertEqual(identifier, [[NSProcessInfo processInfo] processIdentifier]); 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarHttpMethod.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarHttpMethod_h 2 | #define RollbarHttpMethod_h 3 | 4 | @import Foundation; 5 | 6 | #pragma mark - RollbarHttpMethod enum 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarHttpMethod) { 9 | RollbarHttpMethod_Head, 10 | RollbarHttpMethod_Get, 11 | RollbarHttpMethod_Post, 12 | RollbarHttpMethod_Put, 13 | RollbarHttpMethod_Patch, 14 | RollbarHttpMethod_Delete, 15 | RollbarHttpMethod_Connect, 16 | RollbarHttpMethod_Options, 17 | RollbarHttpMethod_Trace, 18 | }; 19 | 20 | #pragma mark - RollbarHttpMethodUtil 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | /// HTTP method enum converter unitilty 25 | @interface RollbarHttpMethodUtil : NSObject 26 | 27 | /// Convert RollbarHttpMethod to a string 28 | /// @param value RollbarHttpMethod value 29 | + (nonnull NSString *) HttpMethodToString:(RollbarHttpMethod)value; 30 | 31 | /// Convert RollbarHttpMethod value from a string 32 | /// @param value string representation of a RollbarHttpMethod value 33 | + (RollbarHttpMethod) HttpMethodFromString:(nullable NSString *)value; 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | 39 | #endif //RollbarHttpMethod_h 40 | -------------------------------------------------------------------------------- /RollbarDeploys/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.7.1 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RollbarDeploys", 7 | platforms: [ 8 | .macOS(.v10_13), 9 | .iOS(.v11), 10 | .tvOS(.v11), 11 | .watchOS(.v4), 12 | ], 13 | products: [ 14 | .library( 15 | name: "RollbarDeploys", 16 | targets: ["RollbarDeploys"]), 17 | ], 18 | dependencies: [ 19 | .package(path: "../RollbarCommon"), 20 | .package(path: "../UnitTesting"), 21 | ], 22 | targets: [ 23 | .target( 24 | name: "RollbarDeploys", 25 | dependencies: ["RollbarCommon"], 26 | path: "Sources/RollbarDeploys" 27 | ), 28 | .testTarget( 29 | name: "RollbarDeploysTests", 30 | dependencies: ["UnitTesting", "RollbarDeploys"] 31 | ), 32 | .testTarget( 33 | name: "RollbarDeploysTests-ObjC", 34 | dependencies: ["UnitTesting", "RollbarDeploys"], 35 | path: "Tests/RollbarDeploysTests-ObjC" 36 | ), 37 | ], 38 | swiftLanguageVersions: [ 39 | SwiftVersion.v5, 40 | ] 41 | ) 42 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests-ObjC/Mocks/Person.h: -------------------------------------------------------------------------------- 1 | // 2 | // Person.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2021-04-29. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface Person : NSObject 13 | 14 | @property (readonly) NSString *firstName; 15 | @property (readonly) NSString *lastName; 16 | @property (readonly) NSDate *birthDate; 17 | @property (readonly) NSNumber *ssn; 18 | @property (readonly) NSInteger age; 19 | 20 | - (instancetype)init NS_UNAVAILABLE; 21 | 22 | - (instancetype)initWithFirstName:(NSString *)firstName 23 | lastName:(NSString *)lastName 24 | age:(NSInteger)age 25 | NS_DESIGNATED_INITIALIZER; 26 | 27 | - (instancetype)initWithFirstName:(NSString *)firstName 28 | lastName:(NSString *)lastName 29 | birthDate:(NSDate *)birthDate 30 | NS_DESIGNATED_INITIALIZER; 31 | 32 | - (instancetype)initWithFirstName:(NSString *)firstName 33 | lastName:(NSString *)lastName 34 | ssn:(NSNumber *)ssn 35 | NS_DESIGNATED_INITIALIZER; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/DesignPatterns/RollbarTaskDispatcher.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTaskDispatcher.h" 2 | 3 | @implementation RollbarTaskDispatcher 4 | 5 | #pragma mark - Properties 6 | 7 | #pragma mark - Lifecycle 8 | 9 | + (instancetype)dispatcherForQueue:(NSOperationQueue *)queue 10 | task:(RollbarTaskBlock)task 11 | taskInput:(id)taskInput { 12 | 13 | RollbarTaskDispatcher *dispatcher = [RollbarTaskDispatcher new]; 14 | dispatcher->_task = [task copy]; 15 | dispatcher->_queue = queue; 16 | dispatcher->_taskInput = taskInput; 17 | 18 | return dispatcher; 19 | } 20 | 21 | #pragma mark - Operations 22 | 23 | - (void)dispatchTask:(RollbarTaskBlock)task input:(id)taskInput { 24 | 25 | [self->_queue addOperationWithBlock:^{ 26 | self->_task(self->_taskInput); 27 | }]; 28 | } 29 | 30 | - (void)dispatchInput:(id)taskInput { 31 | 32 | [self dispatchTask:self->_task input:taskInput]; 33 | } 34 | 35 | - (void)dispatch { 36 | [self dispatchInput:self->_taskInput]; 37 | } 38 | 39 | #pragma mark - NSObject 40 | 41 | - (NSString *)description { 42 | return super.description; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarPayloadPostReply.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarPayloadPostReply.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-13. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface RollbarPayloadPostReply : NSObject 13 | 14 | @property (readonly) NSInteger statusCode; 15 | @property (readonly) NSUInteger rateLimit; 16 | @property (readonly) NSUInteger remainingCount; 17 | @property (readonly) NSUInteger remainingSeconds; 18 | @property (readonly) NSDate *nextPostTime; 19 | 20 | - (instancetype)initWithStatusCode:(NSUInteger)statusCode 21 | rateLimit:(NSUInteger)rateLimit 22 | remainingCount:(NSUInteger)remainingCount 23 | remainingSeconds:(NSUInteger)remainingSeconds; 24 | 25 | - (instancetype)init NS_UNAVAILABLE; 26 | + (instancetype)new NS_UNAVAILABLE; 27 | 28 | + (nullable RollbarPayloadPostReply *)replyFromHttpResponse:(nonnull NSHTTPURLResponse *)httpResponse; 29 | + (nonnull RollbarPayloadPostReply *)greenReply; 30 | + (nonnull RollbarPayloadPostReply *)yellowReply; 31 | + (nonnull RollbarPayloadPostReply *)redReply; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/DTOs/RollbarDTO+CustomData.m: -------------------------------------------------------------------------------- 1 | #import "RollbarDTO+CustomData.h" 2 | 3 | @implementation RollbarDTO (CustomData) 4 | 5 | - (void)addKeyed:(NSString *)aKey DataTransferObject:(RollbarDTO *)aValue { 6 | [self->_data setValue:aValue forKey:aKey]; 7 | } 8 | 9 | - (void)addKeyed:(NSString *)aKey String:(NSString *)aValue { 10 | [self->_data setValue:aValue.mutableCopy forKey:aKey]; 11 | } 12 | 13 | - (void)addKeyed:(NSString *)aKey Number:(NSNumber *)aValue { 14 | [self->_data setValue:aValue forKey:aKey]; 15 | } 16 | 17 | - (void)addKeyed:(NSString *)aKey Array:(NSArray *)aValue { 18 | [self->_data setValue:aValue.mutableCopy forKey:aKey]; 19 | } 20 | 21 | - (void)addKeyed:(NSString *)aKey Dictionary:(NSDictionary *)aValue { 22 | [self->_data setValue:aValue.mutableCopy forKey:aKey]; 23 | } 24 | 25 | - (void)addKeyed:(NSString *)aKey Placeholder:(NSNull *)aValue { 26 | [self->_data setValue:aValue.mutableCopy forKey:aKey]; 27 | } 28 | 29 | - (BOOL)tryAddKeyed:(NSString *)aKey Object:(NSObject *)aValue { 30 | if ([RollbarDTO isTransferableDataValue:aValue]) { 31 | self->_data[aKey] = aValue; 32 | return YES; 33 | } 34 | return NO; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Description of the change 2 | 3 | > Please include a summary of the change and which issues are fixed. 4 | > Please also include relevant motivation and context. 5 | 6 | ## Type of change 7 | 8 | - [ ] Bug fix (non-breaking change that fixes an issue) 9 | - [ ] New feature (non-breaking change that adds functionality) 10 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 11 | - [ ] Maintenance 12 | - [ ] New release 13 | 14 | ## Related issues 15 | 16 | > Shortcut stories and GitHub issues (delete irrelevant) 17 | 18 | - Fix [SC-] 19 | - Fix #1 20 | 21 | ## Checklists 22 | 23 | ### Development 24 | 25 | - [ ] Lint rules pass locally 26 | - [ ] The code changed/added as part of this pull request has been covered with tests 27 | - [ ] All tests related to the changed code pass in development 28 | 29 | ### Code review 30 | 31 | - [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached 32 | - [ ] "Ready for review" label attached to the PR and reviewers assigned 33 | - [ ] Issue from task tracker has a link to this pull request 34 | - [ ] Changes have been reviewed by at least one other engineer 35 | -------------------------------------------------------------------------------- /UnitTesting/Sources/UnitTesting/RollbarTestHelper.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @objc public class RollbarTestHelper: NSObject { 4 | 5 | private static let rollbarUnitTestEnvironment = "Rollbar-Apple-UnitTests"; 6 | private static let rollbarUnitTestPayloadsAccessToken = "09da180aba21479e9ed3d91e0b8d58d6"; 7 | private static let rollbarUnitTestDeploysWriteAccessToken = "a63c9c2f61be4746a888e9cad19a7a9f"; 8 | private static let rollbarUnitTestDeploysReadAccessToken = "3520e804c6234873bad3c6b4a8de7476"; 9 | 10 | 11 | @objc public static func getRollbarEnvironment() -> String { 12 | return RollbarTestHelper.rollbarUnitTestEnvironment; 13 | } 14 | 15 | @objc public static func getRollbarPayloadsAccessToken() -> String { 16 | return RollbarTestHelper.rollbarUnitTestPayloadsAccessToken; 17 | } 18 | 19 | @objc public static func getRollbarDeploysWriteAccessToken() -> String { 20 | return RollbarTestHelper.rollbarUnitTestDeploysWriteAccessToken; 21 | } 22 | 23 | @objc public static func getRollbarDeploysReadAccessToken() -> String { 24 | return RollbarTestHelper.rollbarUnitTestDeploysReadAccessToken; 25 | } 26 | 27 | private override init() { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests/NSDictionary+RollbarTest.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Foundation 3 | import RollbarCommon 4 | @testable import RollbarCommon 5 | 6 | final class NSDictionaryRollbarTests: XCTestCase { 7 | 8 | func testNSDictionaryRollbar_keyPresent() { 9 | 10 | let data:NSDictionary = [ 11 | "key1": "Value 1", 12 | "key2": "Value 2", 13 | "key3": NSNull(), 14 | ]; 15 | 16 | XCTAssertTrue(data.rollbar_valuePresent( 17 | forKey: "key1", 18 | withContext: self.rollbar_objectClassName() 19 | )); 20 | XCTAssertTrue(data.rollbar_valuePresent( 21 | forKey: "key2", 22 | withContext: self.rollbar_objectClassName() 23 | )); 24 | XCTAssertFalse(data.rollbar_valuePresent( 25 | forKey: "key3", 26 | withContext: self.rollbar_objectClassName() 27 | )); 28 | XCTAssertFalse(data.rollbar_valuePresent( 29 | forKey: "non-existent-key", 30 | withContext: self.rollbar_objectClassName() 31 | )); 32 | } 33 | 34 | static var allTests = [ 35 | ("testNSDictionaryRollbar_keyPresent", testNSDictionaryRollbar_keyPresent), 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryType.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryType_h 2 | #define RollbarTelemetryType_h 3 | 4 | @import Foundation; 5 | 6 | #pragma mark - RollbarTelemetryType 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarTelemetryType) { 9 | RollbarTelemetryType_Log, 10 | RollbarTelemetryType_View, 11 | RollbarTelemetryType_Error, 12 | RollbarTelemetryType_Navigation, 13 | RollbarTelemetryType_Network, 14 | RollbarTelemetryType_Connectivity, 15 | RollbarTelemetryType_Manual 16 | }; 17 | 18 | 19 | #pragma mark - RollbarLevel utility 20 | 21 | NS_ASSUME_NONNULL_BEGIN 22 | 23 | /// RollbarTelemetryType utility 24 | @interface RollbarTelemetryTypeUtil : NSObject 25 | 26 | /// Converts RollbarTelemetryType enum value to its string equivalent or default string. 27 | /// @param value RollbarTelemetryType enum value 28 | + (NSString *) RollbarTelemetryTypeToString:(RollbarTelemetryType)value; 29 | 30 | /// Converts string value into its RollbarTelemetryType enum value equivalent or default enum value. 31 | /// @param value input string 32 | + (RollbarTelemetryType) RollbarTelemetryTypeFromString:(nullable NSString *)value; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | 38 | #endif //RollbarTelemetryType_h 39 | 40 | -------------------------------------------------------------------------------- /RollbarAUL/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.7.1 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RollbarAUL", 7 | platforms: [ 8 | .macOS(.v10_13), 9 | .iOS(.v11), 10 | .tvOS(.v11), 11 | .watchOS(.v4), 12 | ], 13 | products: [ 14 | .library( 15 | name: "RollbarAUL", 16 | targets: ["RollbarAUL"]), 17 | ], 18 | dependencies: [ 19 | .package(path: "../RollbarCommon"), 20 | .package(path: "../RollbarNotifier"), 21 | .package(path: "../UnitTesting"), 22 | ], 23 | targets: [ 24 | .target( 25 | name: "RollbarAUL", 26 | dependencies: ["RollbarCommon", "RollbarNotifier"], 27 | path: "Sources/RollbarAUL", 28 | publicHeadersPath: "include" 29 | ), 30 | .testTarget( 31 | name: "RollbarAULTests", 32 | dependencies: ["UnitTesting", "RollbarAUL"] 33 | ), 34 | .testTarget( 35 | name: "RollbarAULTests-ObjC", 36 | dependencies: ["UnitTesting", "RollbarAUL"], 37 | path: "Tests/RollbarAULTests-ObjC" 38 | ), 39 | ], 40 | swiftLanguageVersions: [ 41 | SwiftVersion.v5, 42 | ] 43 | ) 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Rollbar-Apple SDK version: v...** 27 | 28 | **Calling the SDK from (x-mark all suitable):** 29 | [] Objective-C 30 | [] Swift 31 | [] Other: 32 | 33 | **Runtime environment (please complete the following information as applicable):** 34 | - Device: [e.g. macMini, iMac, iPhone, etc.] 35 | - OS: [e.g. iOS, macOS, etc] 36 | - OS version: 37 | - Browser [e.g. chrome, safari] 38 | - Browser version: 39 | 40 | **Smartphone (please complete the following information):** 41 | - Device: [e.g. iPhone6] 42 | - OS: [e.g. iOS8.1] 43 | - Browser [e.g. stock browser, safari] 44 | - Version [e.g. 22] 45 | 46 | **Additional context** 47 | Add any other context about the problem here. 48 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/RollbarFileIOUtil.m: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarFileIOUtil.m 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-01. 6 | // 7 | 8 | #import "RollbarFileIOUtil.h" 9 | #import "RollbarInternalLogging.h" 10 | 11 | @implementation RollbarFileIOUtil 12 | 13 | + (nullable NSURL *)applicationSupportDirectory { 14 | 15 | return [RollbarFileIOUtil directory:NSApplicationSupportDirectory]; 16 | } 17 | 18 | + (nullable NSURL *)applicationCachesDirectory { 19 | 20 | return [RollbarFileIOUtil directory:NSCachesDirectory]; 21 | } 22 | 23 | + (nullable NSURL *)directory:(NSSearchPathDirectory)directory { 24 | 25 | NSError *error = nil; 26 | NSURL *url = [[NSFileManager defaultManager] URLForDirectory:directory 27 | inDomain:NSUserDomainMask 28 | appropriateForURL:nil 29 | create:YES 30 | error:&error]; 31 | if (!url && error) { 32 | 33 | RBCErr(@"Error while locating system directory %@: %@", directory, [error localizedDescription]); 34 | } 35 | 36 | return url; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarCallStackFrameContext.m: -------------------------------------------------------------------------------- 1 | #import "RollbarCallStackFrameContext.h" 2 | 3 | static NSString * const DFK_PRE_CODE_LINES = @"pre"; 4 | static NSString * const DFK_POST_CODE_LINES = @"post"; 5 | 6 | @implementation RollbarCallStackFrameContext 7 | 8 | #pragma mark - Properties 9 | 10 | -(nullable NSArray *)preCodeLines{ 11 | return [self getDataByKey:DFK_PRE_CODE_LINES]; 12 | } 13 | 14 | -(void)setPreCodeLines:(nullable NSArray *)preCodeLines { 15 | [self setData:preCodeLines byKey:DFK_PRE_CODE_LINES]; 16 | } 17 | 18 | -(nullable NSArray *)postCodeLines{ 19 | return [self getDataByKey:DFK_POST_CODE_LINES]; 20 | } 21 | 22 | -(void)setPostCodeLines:(nullable NSArray *)postCodeLines { 23 | [self setData:postCodeLines byKey:DFK_POST_CODE_LINES]; 24 | } 25 | 26 | #pragma mark - Initializers 27 | 28 | -(instancetype)initWithPreCodeLines:(nullable NSArray *)pre 29 | postCodeLines:(nullable NSArray *)post { 30 | 31 | self = [super initWithDictionary:@{ 32 | DFK_PRE_CODE_LINES: pre ? pre : [NSNull null], 33 | DFK_POST_CODE_LINES: post ? post : [NSNull null] 34 | }]; 35 | return self; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /podpub.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | shopt -s nullglob 3 | set -e 4 | 5 | declare -a PODSPECS=(RollbarCommon RollbarCrashReport RollbarNotifier RollbarSwift RollbarDeploys RollbarAUL RollbarCocoaLumberjack) 6 | declare -a OPTIONS=() 7 | 8 | function help { 9 | echo "Usage: $ $0 [-v|--verbose] [--tag ]" 10 | echo "Options:" 11 | echo " --tag Tag with version matching podspec." 12 | echo " -v, --verbose Show more debugging information." 13 | echo " --help Print help information." 14 | } 15 | 16 | while [ $# -gt 0 ]; do 17 | case $1 in 18 | -v|--verbose|--allow-warnings) 19 | OPTIONS+=($1) 20 | shift 21 | ;; 22 | --tag) 23 | TAG=$2 24 | shift 2 25 | ;; 26 | --help) 27 | help 28 | exit 1 29 | ;; 30 | *) 31 | break 32 | ;; 33 | esac 34 | done 35 | 36 | if [ -z ${TAG:=$(git tag --points-at HEAD)} ]; then 37 | echo "WARN: Couldn't figure out git tag, only lint is available." 38 | 39 | for PODSPEC in ${PODSPECS[@]}; do 40 | pod spec lint $(IFS=$' '; echo ${OPTIONS[*]}) $PODSPEC.podspec 41 | done 42 | else 43 | for PODSPEC in ${PODSPECS[@]}; do 44 | pod trunk push $(IFS=$' '; echo ${OPTIONS[*]}) $PODSPEC.podspec 45 | pod repo update 46 | done 47 | fi 48 | 49 | exit 0 50 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarMessage.m: -------------------------------------------------------------------------------- 1 | #import "RollbarMessage.h" 2 | #import 3 | 4 | static NSString * const DFK_BODY = @"body"; 5 | 6 | @implementation RollbarMessage 7 | 8 | #pragma mark - properties 9 | 10 | - (NSString *)body { 11 | return [self safelyGetStringByKey:DFK_BODY]; 12 | } 13 | 14 | - (void)setBody:(NSString *)messageBody { 15 | [self setString:messageBody forKey:DFK_BODY]; 16 | } 17 | 18 | #pragma mark - Initializers 19 | 20 | -(instancetype)initWithBody:(nonnull NSString *)messageBody { 21 | 22 | self = [super initWithDictionary:@{ 23 | DFK_BODY:messageBody ? messageBody : [NSNull null] 24 | }]; 25 | return self; 26 | } 27 | 28 | -(instancetype)initWithNSError:(nonnull NSError *)error { 29 | 30 | NSString *messageBody = [NSString stringWithFormat:@"NSError: %@", error.description]; 31 | self = [super initWithDictionary:@{ 32 | DFK_BODY:messageBody ? messageBody : [NSNull null], 33 | @"error_code": [NSNumber numberWithInteger:error.code], 34 | @"error_domain": error.domain, 35 | @"error_help_anchor": error.helpAnchor ? error.helpAnchor :[NSNull null], 36 | @"error_user_info": [RollbarDTO isTransferableObject: error.userInfo] ? error.userInfo : [NSNull null] 37 | }]; 38 | return self; 39 | } 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarThread.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | #import "RollbarConfig.h" 4 | #import "RollbarPayload.h" 5 | #import "RollbarDestinationRecord.h" 6 | 7 | NS_ASSUME_NONNULL_BEGIN 8 | 9 | @interface RollbarThread : NSThread 10 | 11 | /// Signifies that the thread is active or not. 12 | @property(atomic) BOOL active; 13 | 14 | - (void)persistPayload:(nonnull RollbarPayload *)payload 15 | withConfig:(nonnull RollbarConfig *)config; 16 | 17 | - (RollbarTriStateFlag)sendPayload:(nonnull NSData *)payload 18 | withConfig:(nonnull RollbarConfig *)config; 19 | 20 | - (instancetype)init NS_UNAVAILABLE; 21 | - (instancetype)initWithTarget:(id)target selector:(SEL)selector object:(nullable id)argument NS_UNAVAILABLE; 22 | - (instancetype)initWithBlock:(void (^)(void))block NS_UNAVAILABLE; 23 | 24 | #pragma mark - Singleton pattern 25 | 26 | + (nonnull instancetype)sharedInstance; 27 | 28 | + (instancetype)new NS_UNAVAILABLE; 29 | + (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 30 | + (instancetype)alloc NS_UNAVAILABLE; 31 | + (id)copyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 32 | + (id)mutableCopyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 33 | 34 | - (void)dealloc NS_UNAVAILABLE; 35 | - (id)copy NS_UNAVAILABLE; 36 | - (id)mutableCopy NS_UNAVAILABLE; 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTrace.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTrace_h 2 | #define RollbarTrace_h 3 | 4 | @import RollbarCommon; 5 | 6 | @class RollbarCallStackFrame; 7 | @class RollbarException; 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | /// Trace data element of a payload 12 | @interface RollbarTrace : RollbarDTO 13 | 14 | #pragma mark - Properties 15 | 16 | /// Required: frames 17 | /// A list of stack frames, ordered such that the most recent call is last in the list. 18 | @property (nonatomic, nonnull) NSArray *frames; 19 | 20 | /// Required: exception 21 | /// An object describing the exception instance. 22 | @property (nonatomic, nonnull) RollbarException *exception; 23 | 24 | #pragma mark - Initializers 25 | 26 | /// Initializer 27 | /// @param exception exception 28 | /// @param frames exception call stack frames 29 | -(instancetype)initWithRollbarException:(nonnull RollbarException *)exception 30 | rollbarCallStackFrames:(nonnull NSArray *)frames; 31 | 32 | /// Initializer 33 | /// @param exception exception 34 | -(instancetype)initWithException:(nonnull NSException *)exception; 35 | 36 | /// Initializer 37 | /// @param crashReport crash report content 38 | -(instancetype)initWithCrashReport:(nonnull NSString *)crashReport; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | 44 | #endif //RollbarTrace_h 45 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarFileReader.h: -------------------------------------------------------------------------------- 1 | // Based off of DDFileReader from http://stackoverflow.com/a/8027618 2 | 3 | #ifndef RollbarFileReader_h 4 | #define RollbarFileReader_h 5 | 6 | @import Foundation; 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | /// File reader 11 | @interface RollbarFileReader : NSObject { 12 | 13 | NSString *filePath; 14 | 15 | NSFileHandle *fileHandle; 16 | NSUInteger currentOffset; 17 | 18 | NSString *lineDelimiter; 19 | NSUInteger chunkSize; 20 | } 21 | 22 | #pragma mark - Properties 23 | 24 | /// Line delimiter. 25 | @property (nonatomic, copy) NSString *lineDelimiter; 26 | 27 | /// Chunk size. 28 | @property (nonatomic) NSUInteger chunkSize; 29 | 30 | #pragma mark - Methods 31 | 32 | - (nullable NSString *)readLine; 33 | 34 | - (NSUInteger)getCurrentOffset; 35 | 36 | - (void)enumerateLinesUsingBlock:(void(^)(NSString *_Nullable, NSUInteger, BOOL *))block; 37 | 38 | #pragma mark - Initializers 39 | 40 | /// Hides parameterless initializer. 41 | - (instancetype)init 42 | NS_UNAVAILABLE; 43 | 44 | /// Designated initializer. 45 | /// @param path a path to a file to read. 46 | /// @param offset an offset to read from. 47 | - (instancetype)initWithFilePath:(NSString *)path andOffset:(NSUInteger)offset 48 | NS_DESIGNATED_INITIALIZER; 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | 54 | #endif //RollbarFileReader_h 55 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarSingleInstancing.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarSingleInstancing_h 2 | #define RollbarSingleInstancing_h 3 | 4 | #import 5 | 6 | 7 | NS_ASSUME_NONNULL_BEGIN 8 | 9 | /// Defines a protocol of a Singleton 10 | @protocol RollbarSingleInstancing 11 | 12 | @required 13 | 14 | /// The singleton instance. 15 | + (instancetype)sharedInstance; 16 | 17 | /// Hides the alloc method. 18 | + (instancetype)alloc NS_UNAVAILABLE; 19 | 20 | /// Hides the new method. 21 | + (instancetype)new NS_UNAVAILABLE; 22 | 23 | /// Hides the method 24 | /// @param zone an allocation zone 25 | + (instancetype)allocWithZone:(NSZone *)zone NS_UNAVAILABLE; 26 | 27 | /// Hides the method. 28 | - (instancetype)copy NS_UNAVAILABLE; 29 | 30 | /// Hides the method. 31 | /// @param zone a zone 32 | - (instancetype)copyWithZone:(NSZone *)zone NS_UNAVAILABLE; 33 | 34 | /// Hides the method. 35 | - (instancetype)mutableCopy NS_UNAVAILABLE; 36 | 37 | /// Hides the method. 38 | /// @param zone a zone 39 | - (instancetype)mutableCopyWithZone:(NSZone *)zone NS_UNAVAILABLE; 40 | 41 | @optional 42 | 43 | /// Attempts to safely dealocate this object. 44 | + (void)attemptDealloc; 45 | 46 | /// Flag signifying the single instance existance. 47 | + (BOOL)sharedInstanceExists; 48 | 49 | @end 50 | 51 | 52 | 53 | NS_ASSUME_NONNULL_END 54 | 55 | #endif //RollbarSingleInstancing_h 56 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarTelemetryLogBody.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTelemetryLogBody.h" 2 | 3 | #pragma mark - constants 4 | 5 | #pragma mark - data field keys 6 | 7 | static NSString * const DFK_MESSAGE = @"message"; 8 | 9 | #pragma mark - class implementation 10 | 11 | @implementation RollbarTelemetryLogBody 12 | 13 | #pragma mark - initializers 14 | 15 | -(instancetype)initWithMessage:(nonnull NSString *)message 16 | extraData:(nullable NSDictionary *)extraData { 17 | 18 | NSMutableDictionary *data = [NSMutableDictionary dictionary]; 19 | if (extraData) { 20 | [data addEntriesFromDictionary:extraData]; 21 | } 22 | [data setObject:message forKey:DFK_MESSAGE]; 23 | self = [super initWithDictionary:data]; 24 | return self; 25 | } 26 | 27 | -(instancetype)initWithMessage:(nonnull NSString *)message { 28 | return [self initWithMessage:message extraData:nil]; 29 | } 30 | 31 | - (instancetype)initWithDictionary:(NSDictionary *)data { 32 | 33 | return [super initWithDictionary:data]; 34 | } 35 | 36 | #pragma mark - property accessors 37 | 38 | - (NSString *)message { 39 | NSString *result = [self safelyGetStringByKey:DFK_MESSAGE]; 40 | return result; 41 | } 42 | 43 | - (void)setMessage:(NSString *)value { 44 | [self setString:value forKey:DFK_MESSAGE]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarServer.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarServer_h 2 | #define RollbarServer_h 3 | 4 | #import "RollbarServerConfig.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Server element of a payload DTO. 9 | /// @note: 10 | /// Can contain any additional arbitrary keys. 11 | @interface RollbarServer : RollbarServerConfig 12 | 13 | #pragma mark - Properties 14 | 15 | /// Optional: cpu 16 | /// @note: 17 | /// A string up to 255 characters 18 | @property (nonatomic, copy, nullable) NSString *cpu; 19 | 20 | #pragma mark - Initializers 21 | 22 | /// Initializer 23 | /// @param cpu server CPU 24 | /// @param host server host 25 | /// @param root server code root 26 | /// @param branch code branch 27 | /// @param codeVersion code version 28 | - (instancetype)initWithCpu:(nullable NSString *)cpu 29 | host:(nullable NSString *)host 30 | root:(nullable NSString *)root 31 | branch:(nullable NSString *)branch 32 | codeVersion:(nullable NSString *)codeVersion; 33 | 34 | /// Initializer 35 | /// @param cpu server CPU 36 | /// @param serverConfig server config element of a RollbarConfig 37 | - (instancetype)initWithCpu:(nullable NSString *)cpu 38 | serverConfig:(nullable RollbarServerConfig *)serverConfig; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | 44 | #endif //RollbarServer_h 45 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryLogBody.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryLogBody_h 2 | #define RollbarTelemetryLogBody_h 3 | 4 | #import "RollbarTelemetryBody.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Telemetry log event body DTO 9 | @interface RollbarTelemetryLogBody : RollbarTelemetryBody 10 | 11 | #pragma mark - Properties 12 | 13 | /// Log message 14 | @property (nonatomic, copy) NSString *message; 15 | 16 | #pragma mark - Initializers 17 | 18 | /// Designated initializer 19 | /// @param message log message 20 | /// @param extraData extra data 21 | -(instancetype)initWithMessage:(nonnull NSString *)message 22 | extraData:(nullable NSDictionary *)extraData 23 | NS_DESIGNATED_INITIALIZER; 24 | 25 | /// Initializer 26 | /// @param message log message 27 | -(instancetype)initWithMessage:(nonnull NSString *)message; 28 | 29 | /// Designated initializer 30 | /// @param data seeding data dictionary 31 | - (instancetype)initWithDictionary:(nullable NSDictionary *)data 32 | NS_DESIGNATED_INITIALIZER; 33 | 34 | /// Hides the initializer 35 | /// @param data seeding data array 36 | - (instancetype)initWithArray:(NSArray *)data 37 | NS_UNAVAILABLE; 38 | 39 | /// Hides the initializer 40 | - (instancetype)init 41 | NS_UNAVAILABLE; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | 47 | #endif //RollbarTelemetryLogBody_h 48 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarTelemetryViewBody.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTelemetryViewBody.h" 2 | 3 | #pragma mark - constants 4 | 5 | #pragma mark - data field keys 6 | 7 | static NSString * const DFK_ELEMENT = @"element"; 8 | 9 | #pragma mark - class implementation 10 | 11 | @implementation RollbarTelemetryViewBody 12 | 13 | #pragma mark - initializers 14 | 15 | -(instancetype)initWithElement:(nonnull NSString *)element 16 | extraData:(nullable NSDictionary *)extraData { 17 | 18 | NSMutableDictionary *data = [NSMutableDictionary dictionary]; 19 | if (extraData) { 20 | [data addEntriesFromDictionary:extraData]; 21 | } 22 | [data setObject:element forKey:DFK_ELEMENT]; 23 | self = [super initWithDictionary:data]; 24 | return self; 25 | } 26 | 27 | -(instancetype)initWithElement:(nonnull NSString *)element { 28 | return [self initWithElement:element extraData:nil]; 29 | } 30 | 31 | - (instancetype)initWithDictionary:(NSDictionary *)data { 32 | 33 | return [super initWithDictionary:data]; 34 | } 35 | 36 | #pragma mark - property accessors 37 | 38 | - (NSString *)element { 39 | NSString *result = [self safelyGetStringByKey:DFK_ELEMENT]; 40 | return result; 41 | } 42 | 43 | - (void)setElement:(NSString *)value { 44 | [self setString:value forKey:DFK_ELEMENT]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/NSJSONSerialization+Rollbar.h: -------------------------------------------------------------------------------- 1 | #ifndef NSJSONSerialization_Rollbar_h 2 | #define NSJSONSerialization_Rollbar_h 3 | 4 | @import Foundation; 5 | 6 | /// Rollbar category for NSJSONSerialization 7 | @interface NSJSONSerialization (Rollbar) 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | /// Returns NSData representation of an object composition representing structured JSON data 12 | /// @param obj object composition representing structured JSON data 13 | /// @param opt JSON writing options 14 | /// @param error error (if any) 15 | /// @param safe safe/valid NSJSONSerialization structure flag 16 | + (nullable NSData *)rollbar_dataWithJSONObject:(id)obj 17 | options:(NSJSONWritingOptions)opt 18 | error:(NSError **)error 19 | safe:(BOOL)safe; 20 | 21 | /// Turns JSON-like object structure into a valid NSJSONSerialization structure 22 | /// @param obj JSON-like object 23 | + (nonnull NSMutableDictionary *)rollbar_safeDataFromJSONObject:(nullable id)obj; 24 | 25 | /// Byte-length of a NSData representation of a JSON structure 26 | /// @param jsonData NSData representation of a JSON structure 27 | + (unsigned long)rollbar_measureJSONDataByteSize:(NSData *)jsonData; 28 | 29 | NS_ASSUME_NONNULL_END 30 | 31 | @end 32 | 33 | #endif //NSJSONSerialization_Rollbar_h 34 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarTelemetryConnectivityBody.m: -------------------------------------------------------------------------------- 1 | #import "RollbarTelemetryConnectivityBody.h" 2 | 3 | #pragma mark - constants 4 | 5 | #pragma mark - data field keys 6 | 7 | static NSString * const DFK_STATUS = @"change"; 8 | 9 | #pragma mark - class implementation 10 | 11 | @implementation RollbarTelemetryConnectivityBody 12 | 13 | #pragma mark - initializers 14 | 15 | -(instancetype)initWithStatus:(nonnull NSString *)status 16 | extraData:(nullable NSDictionary *)extraData { 17 | 18 | NSMutableDictionary *data = [NSMutableDictionary dictionary]; 19 | if (extraData) { 20 | [data addEntriesFromDictionary:extraData]; 21 | } 22 | [data setObject:status forKey:DFK_STATUS]; 23 | self = [super initWithDictionary:data]; 24 | return self; 25 | } 26 | 27 | -(instancetype)initWithStatus:(nonnull NSString *)status { 28 | return [self initWithStatus:status extraData:nil]; 29 | } 30 | 31 | - (instancetype)initWithDictionary:(NSDictionary *)data { 32 | 33 | return [super initWithDictionary:data]; 34 | } 35 | 36 | #pragma mark - property accessors 37 | 38 | - (NSString *)status { 39 | NSString *result = [self safelyGetStringByKey:DFK_STATUS]; 40 | return result; 41 | } 42 | 43 | - (void)setStatus:(NSString *)value { 44 | [self setString:value forKey:DFK_STATUS]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryViewBody.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryViewBody_h 2 | #define RollbarTelemetryViewBody_h 3 | 4 | #import "RollbarTelemetryBody.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Telemetry view event body DTO 9 | @interface RollbarTelemetryViewBody : RollbarTelemetryBody 10 | 11 | #pragma mark - Properties 12 | 13 | /// View element name 14 | @property (nonatomic, copy) NSString *element; 15 | 16 | #pragma mark - Initializers 17 | 18 | /// Designated initializer 19 | /// @param element view element name 20 | /// @param extraData extra data 21 | -(instancetype)initWithElement:(nonnull NSString *)element 22 | extraData:(nullable NSDictionary *)extraData 23 | NS_DESIGNATED_INITIALIZER; 24 | 25 | /// Initializer 26 | /// @param element view element name 27 | -(instancetype)initWithElement:(nonnull NSString *)element; 28 | 29 | /// Designated initializer 30 | /// @param data seeding data dictionary 31 | - (instancetype)initWithDictionary:(nullable NSDictionary *)data 32 | NS_DESIGNATED_INITIALIZER; 33 | 34 | /// Hides the initializer 35 | /// @param data seeding data array 36 | - (instancetype)initWithArray:(NSArray *)data 37 | NS_UNAVAILABLE; 38 | 39 | /// Hides the initializer 40 | - (instancetype)init 41 | NS_UNAVAILABLE; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | 47 | #endif //RollbarTelemetryViewBody_h 48 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarProxy.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarProxy_h 2 | #define RollbarProxy_h 3 | 4 | @import RollbarCommon; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Proxy settings of a configuration 9 | @interface RollbarProxy : RollbarDTO 10 | 11 | #pragma mark - properties 12 | 13 | /// Enables/disables usage of these proxy settings 14 | @property (nonatomic, readonly) BOOL enabled; 15 | 16 | /// Proxy URI to use 17 | @property (nonatomic, readonly, copy) NSString *proxyUrl; 18 | 19 | /// Proxy port to use 20 | @property (nonatomic, readonly) NSUInteger proxyPort; 21 | 22 | #pragma mark - initializers 23 | 24 | /// Initializer 25 | /// @param enabled rnables/disables usage of these proxy settings 26 | /// @param proxyUrl proxy URI 27 | /// @param proxyPort proxy port 28 | - (instancetype)initWithEnabled:(BOOL)enabled 29 | proxyUrl:(NSString *)proxyUrl 30 | proxyPort:(NSUInteger)proxyPort; 31 | 32 | @end 33 | 34 | @interface RollbarMutableProxy : RollbarProxy 35 | 36 | #pragma mark - properties 37 | 38 | /// Enables/disables usage of these proxy settings 39 | @property (nonatomic, readwrite) BOOL enabled; 40 | 41 | /// Proxy URI to use 42 | @property (nonatomic, readwrite, copy) NSString *proxyUrl; 43 | 44 | /// Proxy port to use 45 | @property (nonatomic, readwrite) NSUInteger proxyPort; 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | 51 | #endif //RollbarProxy_h 52 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarException.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarException_h 2 | #define RollbarException_h 3 | 4 | @import RollbarCommon; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Exception specifc data element of a payload 9 | @interface RollbarException : RollbarDTO 10 | 11 | #pragma mark - Properties 12 | 13 | /// Required: class 14 | /// The exception class name. 15 | @property (nonatomic, copy, nonnull) NSString *exceptionClass; 16 | 17 | /// Optional: message 18 | /// The exception message, as a string 19 | @property (nonatomic, copy, nullable) NSString *exceptionMessage; 20 | 21 | /// Optional: description 22 | /// An alternate human-readable string describing the exception 23 | /// Usually the original exception message will have been machine-generated; 24 | /// you can use this to send something custom 25 | @property (nonatomic, copy, nullable) NSString *exceptionDescription; 26 | 27 | #pragma mark - Initializers 28 | 29 | /// Initializer 30 | /// @param exceptionClass exception class 31 | /// @param exceptionMessage exception message 32 | /// @param exceptionDescription exception description 33 | - (instancetype)initWithExceptionClass:(nonnull NSString *)exceptionClass 34 | exceptionMessage:(nullable NSString *)exceptionMessage 35 | exceptionDescription:(nullable NSString *)exceptionDescription; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | 41 | #endif //RollbarException_h 42 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/DesignPatterns/RollbarReceptionist.m: -------------------------------------------------------------------------------- 1 | #import "RollbarReceptionist.h" 2 | 3 | @implementation RollbarReceptionist 4 | 5 | #pragma mark - Properties 6 | 7 | #pragma mark - Lifecycle 8 | 9 | + (instancetype)receptionistForKeyPath:(NSString *)path 10 | object:(id)obj 11 | queue:(NSOperationQueue *)queue 12 | task:(RollbarReceptionistTaskBlock)task { 13 | 14 | RollbarReceptionist *receptionist = [RollbarReceptionist new]; 15 | receptionist->_task = [task copy]; 16 | receptionist->_observedKeyPath = [path copy]; 17 | receptionist->_observedObject = obj; 18 | receptionist->_queue = queue; 19 | [obj addObserver:receptionist 20 | forKeyPath:path 21 | options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld 22 | context:0]; 23 | return receptionist; 24 | } 25 | 26 | #pragma mark - Operations 27 | 28 | - (void)observeValueForKeyPath:(NSString *)keyPath 29 | ofObject:(id)object 30 | change:(NSDictionary *)change 31 | context:(void *)context { 32 | 33 | [self->_queue addOperationWithBlock:^{ 34 | self->_task(keyPath, object, change); 35 | }]; 36 | } 37 | 38 | #pragma mark - NSObject 39 | 40 | - (NSString *)description { 41 | return super.description; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarMemoryUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarMemoryUtil.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-04-07. 6 | // 7 | 8 | #ifndef RollbarMemoryUtil_h 9 | #define RollbarMemoryUtil_h 10 | 11 | @import Foundation; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface RollbarMemoryUtil : NSObject 16 | 17 | #pragma mark - memory stats getters 18 | 19 | + (nonnull NSDictionary *)getMemoryStats; 20 | + (nullable NSDictionary *)getPhysicalMemoryStats; 21 | + (nullable NSDictionary *)getVirtualMemoryStats; 22 | + (NSUInteger)getPhysicalMemoryInBytes; 23 | 24 | #pragma mark - converters 25 | 26 | + (NSUInteger)convertToMBs:(NSUInteger)bytesCount; 27 | + (NSString *)convertToHumanFriendlyFormat:(NSUInteger)bytesCount; 28 | 29 | #pragma mark - convenience methods 30 | 31 | + (NSUInteger)getPhysicalMemoryInMBs; 32 | 33 | #pragma mark - convenience string presenters 34 | 35 | + (NSString *)getPhysicalMemorySizeWithUnits; 36 | 37 | #pragma mark - static utility nature 38 | 39 | + (instancetype)new NS_UNAVAILABLE; 40 | + (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 41 | + (instancetype)alloc NS_UNAVAILABLE; 42 | + (id)copyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 43 | + (id)mutableCopyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 44 | 45 | @end 46 | 47 | NS_ASSUME_NONNULL_END 48 | 49 | #endif //RollbarMemoryUtil_h 50 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarPayloadDTOs.h: -------------------------------------------------------------------------------- 1 | // The DTO abstraction: 2 | //#import "RollbarDTOAbstraction.h" 3 | 4 | // App domain enums: 5 | #import "RollbarCaptureIpType.h" 6 | #import "RollbarHttpMethod.h" 7 | #import "RollbarAppLanguage.h" 8 | #import "RollbarSource.h" 9 | 10 | // DTO types: 11 | #import "RollbarPayload.h" 12 | #import "RollbarData.h" 13 | #import "RollbarBody.h" 14 | #import "RollbarMessage.h" 15 | #import "RollbarTrace.h" 16 | #import "RollbarCallStackFrame.h" 17 | #import "RollbarCallStackFrameContext.h" 18 | #import "RollbarException.h" 19 | #import "RollbarRawCrashReport.h" 20 | #import "RollbarConfig.h" 21 | #import "RollbarServerConfig.h" 22 | #import "RollbarDestination.h" 23 | #import "RollbarDeveloperOptions.h" 24 | #import "RollbarProxy.h" 25 | #import "RollbarScrubbingOptions.h" 26 | #import "RollbarRequest.h" 27 | #import "RollbarPerson.h" 28 | #import "RollbarModule.h" 29 | #import "RollbarTelemetryOptions.h" 30 | #import "RollbarLoggingOptions.h" 31 | #import "RollbarServer.h" 32 | 33 | #import "RollbarTelemetryType.h" 34 | #import "RollbarTelemetryEvent.h" 35 | 36 | #import "RollbarTelemetryBody.h" 37 | #import "RollbarTelemetryLogBody.h" 38 | #import "RollbarTelemetryViewBody.h" 39 | #import "RollbarTelemetryErrorBody.h" 40 | #import "RollbarTelemetryNavigationBody.h" 41 | #import "RollbarTelemetryNetworkBody.h" 42 | #import "RollbarTelemetryConnectivityBody.h" 43 | #import "RollbarTelemetryManualBody.h" 44 | 45 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryConnectivityBody.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryConnectivityBody_h 2 | #define RollbarTelemetryConnectivityBody_h 3 | 4 | #import "RollbarTelemetryBody.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Telemetry connectivity event's body 9 | @interface RollbarTelemetryConnectivityBody : RollbarTelemetryBody 10 | 11 | #pragma mark - Properties 12 | 13 | /// Connectivity status 14 | @property (nonatomic, copy) NSString *status; 15 | 16 | #pragma mark - Initializers 17 | 18 | /// Designated initializer 19 | /// @param status connectivity status 20 | /// @param extraData extra data 21 | -(instancetype)initWithStatus:(nonnull NSString *)status 22 | extraData:(nullable NSDictionary *)extraData 23 | NS_DESIGNATED_INITIALIZER; 24 | 25 | /// Initializer 26 | /// @param status connectivity status 27 | -(instancetype)initWithStatus:(nonnull NSString *)status; 28 | 29 | /// Designated serializer 30 | /// @param data seeding data dictionary 31 | - (instancetype)initWithDictionary:(nullable NSDictionary *)data 32 | NS_DESIGNATED_INITIALIZER; 33 | 34 | /// Hides the initializer 35 | /// @param data seeding data array 36 | - (instancetype)initWithArray:(NSArray *)data 37 | NS_UNAVAILABLE; 38 | 39 | /// Hides the initializer 40 | - (instancetype)init 41 | NS_UNAVAILABLE; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | 47 | #endif //RollbarTelemetryConnectivityBody_h 48 | -------------------------------------------------------------------------------- /RollbarAUL/Sources/RollbarAUL/RollbarAulLogLevelConverter.m: -------------------------------------------------------------------------------- 1 | #import "RollbarAulLogLevelConverter.h" 2 | 3 | #if TARGET_OS_OSX 4 | 5 | API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0)) 6 | @implementation RollbarAulLogLevelConverter 7 | 8 | + (os_log_type_t) RollbarLevelToAulLevel:(RollbarLevel)value 9 | API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0)) { 10 | 11 | switch (value) { 12 | case RollbarLevel_Debug: 13 | return OS_LOG_TYPE_DEBUG; 14 | case RollbarLevel_Info: 15 | return OS_LOG_TYPE_INFO; 16 | case RollbarLevel_Warning: 17 | return OS_LOG_TYPE_DEFAULT; 18 | case RollbarLevel_Error: 19 | return OS_LOG_TYPE_ERROR; 20 | case RollbarLevel_Critical: 21 | return OS_LOG_TYPE_FAULT; 22 | } 23 | } 24 | 25 | + (RollbarLevel) RollbarLevelFromAulLevel:(os_log_type_t)value 26 | API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0)) { 27 | 28 | switch (value) { 29 | case OS_LOG_TYPE_DEBUG: 30 | return RollbarLevel_Debug; 31 | case OS_LOG_TYPE_INFO: 32 | return RollbarLevel_Info; 33 | case OS_LOG_TYPE_ERROR: 34 | return RollbarLevel_Error; 35 | case OS_LOG_TYPE_FAULT: 36 | return RollbarLevel_Critical; 37 | case OS_LOG_TYPE_DEFAULT: 38 | return RollbarLevel_Warning; 39 | } 40 | } 41 | 42 | @end 43 | 44 | #endif //TARGET_OS_OSX 45 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests-ObjC/Mocks/Person.m: -------------------------------------------------------------------------------- 1 | // 2 | // Person.m 3 | // 4 | // 5 | // Created by Andrey Kornich on 2021-04-29. 6 | // 7 | 8 | #import "Person.h" 9 | 10 | @implementation Person 11 | 12 | - (instancetype)initWithFirstName:(NSString *)firstName 13 | lastName:(NSString *)lastName 14 | age:(NSInteger)age { 15 | 16 | self = [super init]; 17 | if (self == nil) { 18 | return nil; 19 | } 20 | 21 | _firstName = firstName; 22 | _lastName = lastName; 23 | _age = age; 24 | 25 | return self; 26 | } 27 | 28 | - (instancetype)initWithFirstName:(NSString *)firstName 29 | lastName:(NSString *)lastName 30 | birthDate:(NSDate *)birthDate { 31 | 32 | self = [super init]; 33 | if (self == nil) { 34 | return nil; 35 | } 36 | 37 | _firstName = firstName; 38 | _lastName = lastName; 39 | _birthDate = birthDate; 40 | 41 | return self; 42 | } 43 | 44 | - (instancetype)initWithFirstName:(NSString *)firstName 45 | lastName:(NSString *)lastName 46 | ssn:(NSNumber *)ssn { 47 | 48 | self = [super init]; 49 | if (self == nil) { 50 | return nil; 51 | } 52 | 53 | _firstName = firstName; 54 | _lastName = lastName; 55 | _ssn = ssn; 56 | 57 | return self; 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarLevel.m: -------------------------------------------------------------------------------- 1 | #import "RollbarLevel.h" 2 | 3 | @implementation RollbarLevelUtil 4 | 5 | + (NSString *)rollbarLevelToString:(RollbarLevel)value { 6 | switch (value) { 7 | case RollbarLevel_Debug: 8 | return @"debug"; 9 | case RollbarLevel_Info: 10 | return @"info"; 11 | case RollbarLevel_Warning: 12 | return @"warning"; 13 | case RollbarLevel_Error: 14 | return @"error"; 15 | case RollbarLevel_Critical: 16 | return @"critical"; 17 | default: 18 | return @"info"; 19 | } 20 | } 21 | 22 | + (RollbarLevel)rollbarLevelFromString:(nullable NSString *)value { 23 | if (value == nil) { 24 | return RollbarLevel_Info; 25 | } else if ([value caseInsensitiveCompare:@"debug"] == NSOrderedSame) { 26 | return RollbarLevel_Debug; 27 | } else if ([value caseInsensitiveCompare:@"info"] == NSOrderedSame) { 28 | return RollbarLevel_Info; 29 | } else if ([value caseInsensitiveCompare:@"warning"] == NSOrderedSame) { 30 | return RollbarLevel_Warning; 31 | } else if ([value caseInsensitiveCompare:@"error"] == NSOrderedSame) { 32 | return RollbarLevel_Error; 33 | } else if ([value caseInsensitiveCompare:@"critical"] == NSOrderedSame) { 34 | return RollbarLevel_Critical; 35 | } else { 36 | return RollbarLevel_Info; 37 | } 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /RollbarAUL/Sources/RollbarAUL/include/RollbarAulStoreMonitor.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarAulStoreMonitor_h 2 | #define RollbarAulStoreMonitor_h 3 | 4 | @import Foundation; 5 | 6 | #if TARGET_OS_OSX 7 | 8 | @import RollbarCommon; 9 | @import RollbarNotifier; 10 | 11 | @class RollbarAulStoreMonitorOptions; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | API_AVAILABLE(macos(10.15)) 16 | API_UNAVAILABLE(ios, tvos, watchos) 17 | /// Defines Rollbar AUL store monitor's protocol 18 | @protocol RollbarAulStoreMonitoring 19 | 20 | @required 21 | 22 | /// Configures AUL stor monitoring with specified options 23 | /// @param options monitoring options 24 | - (id)configureWithOptions:(nullable RollbarAulStoreMonitorOptions *)options; 25 | 26 | /// Configures store monitoring with specific Rollbar logger to use 27 | /// @param logger a Rollbar logger 28 | - (id)configureRollbarLogger:(nullable RollbarLogger *)logger; 29 | 30 | /// Starts the monitoring 31 | - (void)start; 32 | 33 | /// Stops the monitoring 34 | - (void)cancel; 35 | 36 | @optional 37 | 38 | // add optionals... 39 | 40 | @end 41 | 42 | 43 | API_AVAILABLE(macos(10.15)) 44 | API_UNAVAILABLE(ios, tvos, watchos) 45 | /// Defines Rollbar AUL store monitor 46 | @interface RollbarAulStoreMonitor 47 | : NSThread 48 | 49 | @end 50 | 51 | NS_ASSUME_NONNULL_END 52 | 53 | #endif //RollbarAulStoreMonitor_h 54 | 55 | #endif //TARGET_OS_OSX 56 | -------------------------------------------------------------------------------- /RollbarAUL/Sources/RollbarAUL/include/RollbarAulOSLogEntryLogLevelConverter.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarAulOSLogEntryLogLevelConverter_h 2 | #define RollbarAulOSLogEntryLogLevelConverter_h 3 | 4 | @import Foundation; 5 | 6 | #if TARGET_OS_OSX 7 | 8 | @import RollbarNotifier; 9 | 10 | #if __has_include() 11 | #include 12 | #endif 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | API_AVAILABLE(macos(10.15)) 17 | API_UNAVAILABLE(ios, tvos, watchos) 18 | /// Rollbar level to/from AUL log level converter 19 | @interface RollbarAulOSLogEntryLogLevelConverter : NSObject 20 | 21 | /// Converts a Rollbar logging level to a OSLogEntryLogLevel 22 | /// @param value Rollbar log level 23 | + (OSLogEntryLogLevel) RollbarLevelToOSLogEntryLogLevel:(RollbarLevel)value 24 | API_AVAILABLE(macos(10.15)) 25 | API_UNAVAILABLE(ios, tvos, watchos) 26 | ; 27 | 28 | /// Converts a OSLogEntryLogLevel to a Rollbar logging level 29 | /// @param value a OSLogEntryLogLevel 30 | + (RollbarLevel) RollbarLevelFromOSLogEntryLogLevel:(OSLogEntryLogLevel)value 31 | API_AVAILABLE(macos(10.15)) 32 | API_UNAVAILABLE(ios, tvos, watchos) 33 | ; 34 | 35 | /// Converts a OSLogEntryLogLevel to a String 36 | /// @param value a OSLogEntryLogLevel 37 | + (NSString *) OSLogEntryLogLevelToString:(OSLogEntryLogLevel)value 38 | API_AVAILABLE(macos(10.15)) 39 | API_UNAVAILABLE(ios, tvos, watchos) 40 | ; 41 | 42 | @end 43 | 44 | NS_ASSUME_NONNULL_END 45 | 46 | #endif //RollbarAulOSLogEntryLogLevelConverter_h 47 | 48 | #endif //TARGET_OS_OSX 49 | -------------------------------------------------------------------------------- /RollbarDeploys/Sources/RollbarDeploys/include/RollbarDeploysManager.h: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 Rollbar. All rights reserved. 2 | 3 | #ifndef RollbarDeploysManager_h 4 | #define RollbarDeploysManager_h 5 | 6 | #import "RollbarDeploysProtocol.h" 7 | @import Foundation; 8 | @import RollbarCommon; 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | /// Rollbar Deploys Manager (a facade client to the Rollbar Deploy APIs) 13 | @interface RollbarDeploysManager : NSObject { 14 | } 15 | 16 | /// Designated initializer 17 | /// @param writeAccessToken write AccessToken 18 | /// @param readAccessToken read AccessToken 19 | /// @param deploymentRegistrationObserver deployment registration observer 20 | /// @param deploymentDetailsObserver deployment details observer 21 | /// @param deploymentDetailsPageObserver deployment details page observer 22 | - (instancetype)initWithWriteAccessToken:(nullable NSString *)writeAccessToken 23 | readAccessToken:(nullable NSString *)readAccessToken 24 | deploymentRegistrationObserver:(nullable NSObject *)deploymentRegistrationObserver 25 | deploymentDetailsObserver:(nullable NSObject *)deploymentDetailsObserver 26 | deploymentDetailsPageObserver:(nullable NSObject *)deploymentDetailsPageObserver 27 | NS_DESIGNATED_INITIALIZER; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | 33 | #endif //RollbarDeploysManager_h 34 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/Sources/RollbarCocoaLumberjack/include/RollbarCocoaLumberjackLogger.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarCocoaLumberjackLogger_h 2 | #define RollbarCocoaLumberjackLogger_h 3 | 4 | #import 5 | @import CocoaLumberjack; 6 | @import RollbarNotifier; 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | /// Rollbar logger for CocoaLumberjack 11 | @interface RollbarCocoaLumberjackLogger : DDAbstractLogger { 12 | @private 13 | RollbarLogger *_rollbarLogger; 14 | } 15 | 16 | #pragma mark - factory methods 17 | 18 | /// Creates initialized instance of the Rollbar logger for CocoaLumberjack 19 | /// @param rollbarLogger a RollbarLogger to use 20 | + (NSObject *)createWithRollbarLogger:(RollbarLogger *)rollbarLogger; 21 | 22 | /// Creates initialized instance of the Rollbar logger for CocoaLumberjack 23 | /// @param rollbarConfig a RollbarConfig to use 24 | + (NSObject *)createWithRollbarConfig:(RollbarConfig *)rollbarConfig; 25 | 26 | #pragma mark - instance initializers 27 | 28 | /// Initializer 29 | /// @param rollbarLogger a RollbarLogger to use 30 | - (instancetype)initWithRollbarLogger:(RollbarLogger *)rollbarLogger 31 | NS_DESIGNATED_INITIALIZER; 32 | 33 | /// Initializer 34 | /// @param rollbarConfig a RollbarConfig to use 35 | - (instancetype)initWithRollbarConfig:(RollbarConfig *)rollbarConfig; 36 | 37 | /// Hides initializer 38 | - (instancetype)init 39 | NS_UNAVAILABLE; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | 45 | #endif //RollbarCocoaLumberjackLogger_h 46 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarTelemetryThread.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarTelemetryThread.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-04-11. 6 | // 7 | 8 | #import 9 | 10 | @class RollbarTelemetryOptions; 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface RollbarTelemetryThread : NSThread 15 | 16 | /// Configures this instance with provided options 17 | /// @param telemetryOptions desired Telemetry options 18 | - (instancetype)configureWithOptions:(nonnull RollbarTelemetryOptions *)telemetryOptions; 19 | 20 | @property (readonly, nonnull) RollbarTelemetryOptions *telemetryOptions; 21 | 22 | /// Signifies that the thread is active or not. 23 | @property(atomic) BOOL active; 24 | 25 | #pragma mark - Sigleton pattern 26 | 27 | + (nonnull instancetype)sharedInstance; 28 | + (BOOL)sharedInstanceExists; 29 | 30 | + (instancetype)new NS_UNAVAILABLE; 31 | + (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 32 | + (instancetype)alloc NS_UNAVAILABLE; 33 | + (id)copyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 34 | + (id)mutableCopyWithZone:(struct _NSZone *)zone NS_UNAVAILABLE; 35 | 36 | - (instancetype)init NS_UNAVAILABLE; 37 | - (instancetype)initWithTarget:(id)target selector:(SEL)selector object:(nullable id)argument NS_UNAVAILABLE; 38 | - (instancetype)initWithBlock:(void (^)(void))block NS_UNAVAILABLE; 39 | 40 | - (void)dealloc NS_UNAVAILABLE; 41 | - (id)copy NS_UNAVAILABLE; 42 | - (id)mutableCopy NS_UNAVAILABLE; 43 | 44 | @end 45 | 46 | NS_ASSUME_NONNULL_END 47 | -------------------------------------------------------------------------------- /RollbarDeploys/Sources/RollbarDeploys/DTOs/RollbarDeploymentDetails.m: -------------------------------------------------------------------------------- 1 | // Copyright © 2018 Rollbar. All rights reserved. 2 | 3 | #import "RollbarDeploymentDetails.h" 4 | 5 | @import RollbarCommon; 6 | 7 | @implementation RollbarDeploymentDetails 8 | 9 | #pragma mark - data field keys 10 | static NSString * const DFK_DEPLOY_ID = @"id"; 11 | static NSString * const DFK_PROJECT_ID = @"project_id"; 12 | static NSString * const DFK_START_TIME = @"start_time"; 13 | static NSString * const DFK_END_TIME = @"finish_time"; 14 | static NSString * const DFK_STATUS = @"status"; 15 | 16 | #pragma mark - properties 17 | 18 | -(NSString *)deployId { 19 | return [self safelyGetNumberByKey:DFK_DEPLOY_ID].description; 20 | } 21 | -(NSString *)projectId { 22 | return [self safelyGetNumberByKey:DFK_PROJECT_ID].description; 23 | } 24 | 25 | -(NSDate *)startTime { 26 | NSNumber *dateNumber = [self safelyGetNumberByKey:DFK_START_TIME]; 27 | NSDate *date = [NSDate dateWithTimeIntervalSince1970:(NSTimeInterval)dateNumber.doubleValue]; 28 | return date; 29 | } 30 | 31 | -(NSDate *)endTime { 32 | NSNumber *dateNumber = [self safelyGetNumberByKey:DFK_END_TIME]; 33 | NSDate *date = [NSDate dateWithTimeIntervalSince1970:(NSTimeInterval)dateNumber.doubleValue]; 34 | return date; 35 | } 36 | 37 | -(NSString *)status { 38 | return [self safelyGetStringByKey:DFK_STATUS] ; 39 | } 40 | 41 | #pragma mark - initializers 42 | 43 | - (instancetype)initWithDictionary:(NSDictionary *)data { 44 | return [super initWithDictionary:data]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportVersion.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashReportVersion.h 3 | // 4 | // Created by Karl Stenerud on 2016-03-10. 5 | // 6 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall remain in place 16 | // in this source code. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #ifndef HDR_RollbarCrashReportVersion_h 28 | #define HDR_RollbarCrashReportVersion_h 29 | 30 | #define RollbarCrashCRASH_REPORT_VERSION "3.3.3" 31 | 32 | #endif /* HDR_RollbarCrashReportVersion_h */ 33 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarServer.m: -------------------------------------------------------------------------------- 1 | #import "RollbarServer.h" 2 | 3 | static NSString *const DFK_CPU = @"cpu"; 4 | 5 | @implementation RollbarServer 6 | 7 | #pragma mark - Properties 8 | 9 | -(nullable NSString *)cpu { 10 | return [self getDataByKey:DFK_CPU]; 11 | } 12 | 13 | -(void)setCpu:(nullable NSString *)cpu { 14 | [self setData:cpu byKey:DFK_CPU]; 15 | } 16 | 17 | #pragma mark - Initializers 18 | 19 | - (instancetype)initWithCpu:(nullable NSString *)cpu 20 | host:(nullable NSString *)host 21 | root:(nullable NSString *)root 22 | branch:(nullable NSString *)branch 23 | codeVersion:(nullable NSString *)codeVersion { 24 | 25 | self = [super initWithHost:host 26 | root:root 27 | branch:branch 28 | codeVersion:codeVersion]; 29 | if (self) { 30 | [self mergeDataDictionary:@{ 31 | DFK_CPU: cpu ? cpu : [NSNull null] 32 | }]; 33 | } 34 | return self; 35 | } 36 | 37 | - (instancetype)initWithCpu:(nullable NSString *)cpu 38 | serverConfig:(nullable RollbarServerConfig *)serverConfig { 39 | 40 | if (serverConfig) { 41 | self = [super initWithDictionary:serverConfig.jsonFriendlyData]; 42 | } 43 | 44 | if (self) { 45 | [self mergeDataDictionary:@{ 46 | DFK_CPU: cpu ? cpu : [NSNull null] 47 | }]; 48 | } 49 | 50 | return self; 51 | } 52 | 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarDestinationRecord.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarDestinationRecord.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-28. 6 | // 7 | 8 | #import 9 | 10 | #import "RollbarConfig.h" 11 | #import "RollbarPayloadPostReply.h" 12 | 13 | @class RollbarRegistry; 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface RollbarDestinationRecord : NSObject 18 | 19 | @property (readonly, nonnull) NSString *destinationID; 20 | 21 | @property (readwrite) NSUInteger localWindowLimit; 22 | 23 | @property (readonly) NSUInteger localWindowCount; 24 | @property (readonly) NSUInteger serverWindowRemainingCount; 25 | @property (readonly, nullable) NSDate *nextLocalWindowStart; 26 | @property (readonly, nullable) NSDate *nextServerWindowStart; 27 | @property (readonly, nonnull) NSDate *nextEarliestPost; 28 | 29 | @property (readonly, nonnull) RollbarRegistry *registry; 30 | 31 | - (BOOL)canPostWithConfig:(nonnull RollbarConfig *)config; 32 | - (void)recordPostReply:(nullable RollbarPayloadPostReply *)reply 33 | withConfig:(nonnull RollbarConfig *)config; 34 | 35 | - (instancetype)initWithConfig:(nonnull RollbarConfig *)config 36 | andRegistry:(nonnull RollbarRegistry *)registry 37 | NS_DESIGNATED_INITIALIZER; 38 | - (instancetype)initWithDestinationID:(nonnull NSString *)destinationID 39 | andRegistry:(nonnull RollbarRegistry *)registry 40 | NS_DESIGNATED_INITIALIZER; 41 | - (instancetype)init NS_UNAVAILABLE; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests-ObjC/NSDate+RollbarTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import RollbarCommon; 4 | 5 | @interface NSDate_RollbarTests : XCTestCase 6 | 7 | @end 8 | 9 | @implementation NSDate_RollbarTests 10 | 11 | - (void)setUp { 12 | // Put setup code here. This method is called before the invocation of each test method in the class. 13 | } 14 | 15 | - (void)tearDown { 16 | // Put teardown code here. This method is called after the invocation of each test method in the class. 17 | } 18 | 19 | - (void)testDateToString { 20 | 21 | if (@available(tvOS 13.0, *)) { 22 | NSString *dateString = [[NSDate date] rollbar_toString]; 23 | XCTAssertNotNil(dateString); 24 | XCTAssertTrue(dateString.length > 0); 25 | } else { 26 | // Fallback on earlier versions 27 | } 28 | } 29 | 30 | - (void)testDateFromString { 31 | 32 | NSDate *date = [NSDate rollbar_dateFromString:@"2022-04-28 at 14:49:29.560000-0700"]; 33 | XCTAssertNotNil(date); 34 | } 35 | 36 | - (void)testPerformanceDateToString { 37 | 38 | [self measureBlock:^{ 39 | 40 | if (@available(tvOS 13.0, *)) { 41 | NSString *dateString = [[NSDate date] rollbar_toString]; 42 | } else { 43 | // Fallback on earlier versions 44 | } 45 | }]; 46 | } 47 | 48 | - (void)testPerformanceDateFromString { 49 | 50 | [self measureBlock:^{ 51 | 52 | NSDate *date = [NSDate rollbar_dateFromString:@"2022-04-28 at 14:49:29.560000-0700"]; 53 | }]; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarPayload.m: -------------------------------------------------------------------------------- 1 | #import "RollbarPayload.h" 2 | #import "RollbarData.h" 3 | 4 | #pragma mark - data field keys 5 | 6 | static NSString * const DFK_ACCESSTOKEN = @"access_token"; 7 | static NSString * const DFK_DATA = @"data"; 8 | 9 | @implementation RollbarPayload 10 | 11 | #pragma mark - properties 12 | 13 | - (NSString *)accessToken { 14 | return [self safelyGetStringByKey:DFK_ACCESSTOKEN]; 15 | } 16 | 17 | - (void)setAccessToken:(NSString *)accessToken { 18 | [self setString:accessToken forKey:DFK_ACCESSTOKEN]; 19 | } 20 | 21 | - (RollbarData *)data { 22 | id data = [self safelyGetDictionaryByKey:DFK_DATA]; 23 | RollbarData *payloadData = [[RollbarData alloc] initWithDictionary:data]; 24 | return payloadData; 25 | } 26 | 27 | - (void)setData:(RollbarData *)payloadData { 28 | [self setDictionary:payloadData.jsonFriendlyData forKey:DFK_DATA]; 29 | } 30 | 31 | #pragma mark - initializers 32 | 33 | -(instancetype)initWithAccessToken:(nonnull NSString *)token 34 | data:(nonnull RollbarData *)data { 35 | 36 | self = [super initWithDictionary:@{ 37 | DFK_ACCESSTOKEN : token, 38 | DFK_DATA : data.jsonFriendlyData 39 | }]; 40 | return self; 41 | } 42 | 43 | -(instancetype)initWithArray:(NSArray *)data { 44 | 45 | @throw [NSException exceptionWithName:NSInternalInconsistencyException 46 | reason:@"Must use initWithDictionary: instead." 47 | userInfo:nil]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /RollbarCommon.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "RollbarCommon" 3 | s.version = "3.3.3" 4 | s.summary = "Application or client side SDK for interacting with the Rollbar API Server." 5 | s.description = <<-DESC 6 | Find, fix, and resolve errors with Rollbar. 7 | Easily send error data using Rollbar API. 8 | Analyze, de-dupe, send alerts, and prepare the data for further analysis. 9 | Search, sort, and prioritize via the Rollbar dashboard. 10 | DESC 11 | s.homepage = "https://rollbar.com" 12 | s.resource = "rollbar-logo.png" 13 | s.license = { :type => "MIT", :file => "LICENSE" } 14 | s.authors = { "Rollbar" => "support@rollbar.com" } 15 | s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", 16 | :tag => s.version.to_s } 17 | s.documentation_url = "https://docs.rollbar.com/docs/apple" 18 | s.social_media_url = "https://twitter.com/rollbar" 19 | 20 | s.osx.deployment_target = "10.13" 21 | s.ios.deployment_target = "11.0" 22 | s.tvos.deployment_target = "11.0" 23 | s.watchos.deployment_target = "4.0" 24 | 25 | s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" 26 | s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" 27 | s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" 28 | 29 | s.framework = "Foundation" 30 | 31 | s.swift_versions = "5.5" 32 | s.requires_arc = true 33 | end 34 | -------------------------------------------------------------------------------- /RollbarCommon/Tests/RollbarCommonTests/RollbarMemoryUtilTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import Foundation 3 | @testable import RollbarCommon 4 | 5 | final class RollbarMemoryUtilTests: XCTestCase { 6 | 7 | func testRollbarMemoryUtil_Basics() throws { 8 | 9 | let memoryStats = RollbarMemoryUtil.getMemoryStats(); 10 | 11 | print(memoryStats); 12 | 13 | XCTAssertTrue(memoryStats["physical"] is NSDictionary); 14 | let physicalMemoryStats = memoryStats["physical"] as! NSDictionary; 15 | XCTAssertTrue((physicalMemoryStats["total_MB"] as! NSNumber).uintValue > 0); 16 | 17 | XCTAssertTrue(memoryStats["vm"] is NSDictionary); 18 | let virtualMemoryStats = memoryStats["vm"] as! NSDictionary; 19 | XCTAssertTrue((virtualMemoryStats["free_MB"] as! NSNumber).uintValue > 0); 20 | XCTAssertTrue((virtualMemoryStats["active_MB"] as! NSNumber).uintValue > 0); 21 | XCTAssertTrue((virtualMemoryStats["inactive_MB"] as! NSNumber).uintValue > 0); 22 | XCTAssertTrue((virtualMemoryStats["speculative_MB"] as! NSNumber).uintValue > 0); 23 | XCTAssertTrue((virtualMemoryStats["wired_MB"] as! NSNumber).uintValue > 0); 24 | } 25 | 26 | func testRollbarMemoryUtil_Performance() throws { 27 | 28 | measure { 29 | _ = RollbarMemoryUtil.getMemoryStats(); 30 | } 31 | } 32 | static var allTests = [ 33 | ("testRollbarMemoryUtil_basics", testRollbarMemoryUtil_Basics), 34 | ("testPerformance", testRollbarMemoryUtil_Performance) 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /RollbarDeploys.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "RollbarDeploys" 3 | s.version = "3.3.3" 4 | s.summary = "Application or client side SDK for interacting with the Rollbar API Server." 5 | s.description = <<-DESC 6 | Find, fix, and resolve errors with Rollbar. 7 | Easily send error data using Rollbar API. 8 | Analyze, de-dupe, send alerts, and prepare the data for further analysis. 9 | Search, sort, and prioritize via the Rollbar dashboard. 10 | DESC 11 | s.homepage = "https://rollbar.com" 12 | s.resource = "rollbar-logo.png" 13 | s.license = { :type => "MIT", :file => "LICENSE" } 14 | s.authors = { "Rollbar" => "support@rollbar.com" } 15 | s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", 16 | :tag => s.version.to_s } 17 | s.documentation_url = "https://docs.rollbar.com/docs/apple" 18 | s.social_media_url = "https://twitter.com/rollbar" 19 | 20 | s.osx.deployment_target = "10.13" 21 | s.ios.deployment_target = "11.0" 22 | s.tvos.deployment_target = "11.0" 23 | 24 | s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" 25 | s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" 26 | s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" 27 | 28 | s.framework = "Foundation" 29 | s.dependency "RollbarCommon", "~> #{s.version}" 30 | 31 | s.swift_versions = "5.5" 32 | s.requires_arc = true 33 | end 34 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarAppLanguage.m: -------------------------------------------------------------------------------- 1 | #import "RollbarAppLanguage.h" 2 | 3 | @implementation RollbarAppLanguageUtil 4 | 5 | + (NSString *) RollbarAppLanguageToString:(RollbarAppLanguage)value { 6 | 7 | switch (value) { 8 | case RollbarAppLanguage_ObjectiveC: 9 | return @"Objective-C"; 10 | case RollbarAppLanguage_ObjectiveCpp: 11 | return @"Objective-C++"; 12 | case RollbarAppLanguage_Swift: 13 | return @"Swift"; 14 | case RollbarAppLanguage_C: 15 | return @"C"; 16 | case RollbarAppLanguage_Cpp: 17 | return @"C++"; 18 | default: 19 | return @"Objective-C"; 20 | } 21 | } 22 | 23 | + (RollbarAppLanguage) RollbarAppLanguageFromString:(NSString *)value { 24 | 25 | if (NSOrderedSame == [value caseInsensitiveCompare:@"Objective-C"]) { 26 | return RollbarAppLanguage_ObjectiveC; 27 | } 28 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"Objective-C++"]) { 29 | return RollbarAppLanguage_ObjectiveCpp; 30 | } 31 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"Swift"]) { 32 | return RollbarAppLanguage_Swift; 33 | } 34 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"C"]) { 35 | return RollbarAppLanguage_C; 36 | } 37 | else if (NSOrderedSame == [value caseInsensitiveCompare:@"C++"]) { 38 | return RollbarAppLanguage_Cpp; 39 | } 40 | else { 41 | return RollbarAppLanguage_ObjectiveC; // default case... 42 | } 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarModule.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarModule_h 2 | #define RollbarModule_h 3 | 4 | @import RollbarCommon; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Module element of a payload 9 | @interface RollbarModule : RollbarDTO 10 | 11 | #pragma mark - initializers 12 | 13 | /// Initializer 14 | /// @param name module name 15 | /// @param version module version 16 | - (instancetype)initWithName:(nullable NSString *)name 17 | version:(nullable NSString *)version; 18 | 19 | /// Initializer 20 | /// @param name module name 21 | - (instancetype)initWithName:(nullable NSString *)name; 22 | 23 | - (instancetype)init 24 | NS_UNAVAILABLE; 25 | 26 | - (instancetype)new 27 | NS_UNAVAILABLE; 28 | 29 | #pragma mark - properties 30 | 31 | /// Optional: name 32 | /// Name of the library 33 | @property (nonatomic, copy, nullable, readonly) NSString *name; 34 | 35 | /// Optional: version 36 | /// Library version string 37 | @property (nonatomic, copy, nullable, readonly) NSString *version; 38 | 39 | @end 40 | 41 | 42 | /// Mutable Module element of a payload 43 | @interface RollbarMutableModule : RollbarModule 44 | 45 | #pragma mark - initializers 46 | 47 | - (instancetype)init; 48 | 49 | #pragma mark - properties 50 | 51 | /// Optional: name 52 | /// Name of the library 53 | @property (nonatomic, copy, nullable, readwrite) NSString *name; 54 | 55 | /// Optional: version 56 | /// Library version string 57 | @property (nonatomic, copy, nullable, readwrite) NSString *version; 58 | 59 | @end 60 | 61 | NS_ASSUME_NONNULL_END 62 | 63 | #endif //RollbarModule_h 64 | -------------------------------------------------------------------------------- /RollbarReport.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "RollbarReport" 3 | s.version = "3.3.3" 4 | s.summary = "Application or client side SDK for interacting with the Rollbar API Server." 5 | s.description = <<-DESC 6 | Find, fix, and resolve errors with Rollbar. 7 | Easily send error data using Rollbar API. 8 | Analyze, de-dupe, send alerts, and prepare the data for further analysis. 9 | Search, sort, and prioritize via the Rollbar dashboard. 10 | DESC 11 | s.homepage = "https://rollbar.com" 12 | s.resource = "rollbar-logo.png" 13 | s.license = { :type => "MIT", :file => "LICENSE" } 14 | s.authors = { "Rollbar" => "support@rollbar.com" } 15 | s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", 16 | :tag => s.version.to_s } 17 | s.documentation_url = "https://docs.rollbar.com/docs/apple" 18 | s.social_media_url = "https://twitter.com/rollbar" 19 | 20 | s.osx.deployment_target = "10.13" 21 | s.ios.deployment_target = "11.0" 22 | s.tvos.deployment_target = "11.0" 23 | s.watchos.deployment_target = "4.0" 24 | 25 | s.module_name = "RollbarReport" 26 | s.source_files = "RollbarNotifier/Sources/RollbarReport/**/*.swift" 27 | 28 | s.framework = "Foundation" 29 | s.dependency "RollbarCrash", "~> #{s.version}" 30 | 31 | s.swift_versions = "5.5" 32 | s.requires_arc = true 33 | 34 | s.xcconfig = { 35 | "USE_HEADERMAP" => "NO" 36 | } 37 | end 38 | -------------------------------------------------------------------------------- /Examples/RollbarDemo/RollbarDemo/Prelude.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension StringProtocol { 4 | 5 | /// Returns an array of `Substring`s by matching the given `String` using 6 | /// this string as a regular expression pattern. 7 | /// 8 | /// Returns `nil` if this string isn't a valid regex pattern, if no 9 | /// matches are found, an empty string is returned. 10 | func matches(in str: String) -> [Substring]? { 11 | let regex = try? NSRegularExpression(pattern: String(self)) 12 | let range = NSRange(str.startIndex.. [Substring] { 22 | guard self.numberOfRanges > 1 else { return [] } 23 | 24 | var result = ContiguousArray() 25 | result.reserveCapacity(self.numberOfRanges) 26 | 27 | for index in 1.. Range? { 39 | Range(self.range(at: index), in: string) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarCrashReportUtil.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarCrashReportUtil_h 2 | #define RollbarCrashReportUtil_h 3 | 4 | @import Foundation; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | typedef NS_ENUM(NSUInteger, RollbarExceptionInfo) { 9 | RollbarExceptionInfo_Type, 10 | RollbarExceptionInfo_Codes, 11 | RollbarExceptionInfo_Backtraces 12 | }; 13 | 14 | typedef NS_ENUM(NSUInteger, RollbarBacktraceComponent) { 15 | RollbarBacktraceComponent_Index = 0, 16 | RollbarBacktraceComponent_Library, 17 | RollbarBacktraceComponent_Address, 18 | RollbarBacktraceComponent_Method, 19 | RollbarBacktraceComponent_LineNumber 20 | }; 21 | 22 | /// Crash report utility. 23 | @interface RollbarCrashReportUtil : NSObject 24 | 25 | /// Splits the provided crash report into collection of report lines. 26 | /// @param report a crash report of interest. 27 | + (nonnull NSArray *)extractLinesFromCrashReport:(nonnull NSString *)report; 28 | 29 | /// Extracts exception related info from the provided crash report. 30 | /// @param crashReport a crash report of interest. 31 | + (nonnull NSDictionary *)extractExceptionInfoFromCrashReport:(nonnull NSString *)crashReport; 32 | 33 | /// Splits a backtrace into its individual components 34 | /// @param backtrace a backtrace. 35 | + (nonnull NSDictionary *)extractComponentsFromBacktrace:(nonnull NSString *)backtrace; 36 | 37 | #pragma mark - Initializers 38 | 39 | /// Hides parameterless initializer. 40 | - (instancetype _Nonnull )init 41 | NS_UNAVAILABLE; 42 | 43 | @end 44 | 45 | NS_ASSUME_NONNULL_END 46 | 47 | #endif /* RollbarCrashReportUtil_h */ 48 | 49 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarNotifierFiles.m: -------------------------------------------------------------------------------- 1 | #import "RollbarNotifierFiles.h" 2 | 3 | static NSString * const PAYLOADS_STORE_FILE_NAME = @"rollbar.db"; 4 | 5 | static NSString * const INCOMING_PAYLOADS_FILE_NAME = @"rollbar.incoming"; 6 | static NSString * const TRANSMITTED_PAYLOADS_FILE_NAME = @"rollbar.transmitted"; 7 | static NSString * const DROPPED_PAYLOADS_FILE_NAME = @"rollbar.dropped"; 8 | 9 | static NSString * const QUEUED_TELEMETRY_ITEMS_FILE_NAME = @"rollbar.telemetry"; 10 | 11 | static NSString * const SESSION_FILE_NAME = @"rollbar.session"; 12 | static NSString * const APP_QUIT_FILE_NAME = @"rollbar.appquit"; 13 | 14 | static NSString * const CONFIG_FILE_NAME = @"rollbar.config"; 15 | 16 | @implementation RollbarNotifierFiles 17 | 18 | + (nonnull NSString * const)payloadsStore { 19 | 20 | return PAYLOADS_STORE_FILE_NAME; 21 | } 22 | 23 | + (nonnull NSString * const)telemetryQueue { 24 | 25 | return QUEUED_TELEMETRY_ITEMS_FILE_NAME; 26 | } 27 | 28 | + (nonnull NSString * const)runtimeSession { 29 | 30 | return SESSION_FILE_NAME; 31 | } 32 | 33 | + (nonnull NSString * const)appQuit { 34 | 35 | return APP_QUIT_FILE_NAME; 36 | } 37 | 38 | + (nonnull NSString * const)incomingPayloadsLog { 39 | 40 | return INCOMING_PAYLOADS_FILE_NAME; 41 | } 42 | 43 | + (nonnull NSString * const)transmittedPayloadsLog { 44 | 45 | return TRANSMITTED_PAYLOADS_FILE_NAME; 46 | } 47 | 48 | + (nonnull NSString * const)droppedPayloadsLog { 49 | 50 | return DROPPED_PAYLOADS_FILE_NAME; 51 | } 52 | 53 | + (nonnull NSString * const)config { 54 | 55 | return CONFIG_FILE_NAME; 56 | } 57 | 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarTelemetryNavigationBody.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarTelemetryNavigationBody_h 2 | #define RollbarTelemetryNavigationBody_h 3 | 4 | #import "RollbarTelemetryBody.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Telemetry navigation event body DTO 9 | @interface RollbarTelemetryNavigationBody : RollbarTelemetryBody 10 | 11 | #pragma mark - Properties 12 | 13 | /// Navigation from 14 | @property (nonatomic, copy) NSString *from; 15 | 16 | /// Navigation to. 17 | @property (nonatomic, copy) NSString *to; 18 | 19 | #pragma mark - Initializers 20 | 21 | /// Designated initializer 22 | /// @param from navigation from 23 | /// @param to navigation to 24 | /// @param extraData extra data 25 | -(instancetype)initWithFromLocation:(nonnull NSString *)from 26 | toLocation:(nonnull NSString *)to 27 | extraData:(nullable NSDictionary *)extraData 28 | NS_DESIGNATED_INITIALIZER; 29 | 30 | /// Initializer 31 | /// @param from navigation from 32 | /// @param to navigation to 33 | -(instancetype)initWithFromLocation:(nonnull NSString *)from 34 | toLocation:(nonnull NSString *)to; 35 | 36 | /// Designated initializer 37 | /// @param data seeding data dictionary 38 | - (instancetype)initWithDictionary:(nullable NSDictionary *)data 39 | NS_DESIGNATED_INITIALIZER; 40 | 41 | /// Hides the initializer 42 | /// @param data seeding data array 43 | - (instancetype)initWithArray:(NSArray *)data 44 | NS_UNAVAILABLE; 45 | 46 | /// Hides the initializer 47 | - (instancetype)init 48 | NS_UNAVAILABLE; 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | 54 | #endif //RollbarTelemetryNavigationBody_h 55 | -------------------------------------------------------------------------------- /RollbarAUL.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "RollbarAUL" 3 | s.version = "3.3.3" 4 | s.summary = "Application or client side SDK for interacting with the Rollbar API Server." 5 | s.description = <<-DESC 6 | Find, fix, and resolve errors with Rollbar. 7 | Easily send error data using Rollbar API. 8 | Analyze, de-dupe, send alerts, and prepare the data for further analysis. 9 | Search, sort, and prioritize via the Rollbar dashboard. 10 | DESC 11 | s.homepage = "https://rollbar.com" 12 | s.resource = "rollbar-logo.png" 13 | s.license = { :type => "MIT", :file => "LICENSE" } 14 | s.authors = { "Rollbar" => "support@rollbar.com" } 15 | s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", 16 | :tag => s.version.to_s } 17 | s.documentation_url = "https://docs.rollbar.com/docs/apple" 18 | s.social_media_url = "https://twitter.com/rollbar" 19 | 20 | s.osx.deployment_target = "10.13" 21 | 22 | s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" 23 | s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" 24 | s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" 25 | 26 | s.framework = "Foundation" 27 | s.dependency "RollbarCommon", "~> #{s.version}" 28 | s.dependency "RollbarNotifier", "~> #{s.version}" 29 | 30 | s.swift_versions = "5.5" 31 | s.requires_arc = true 32 | s.xcconfig = { 33 | "USE_HEADERMAP" => "NO", 34 | "HEADER_SEARCH_PATHS" => "$(PODS_ROOT)/#{s.name}/#{s.name}/Sources/#{s.name}/**" 35 | } 36 | end 37 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashMonitor_System.h 3 | // 4 | // Created by Karl Stenerud on 2012-02-05. 5 | // 6 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall remain in place 16 | // in this source code. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #ifndef RollbarCrashMonitor_System_h 28 | #define RollbarCrashMonitor_System_h 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | 35 | #include "RollbarCrashMonitor.h" 36 | 37 | 38 | /** Access the Monitor API. 39 | */ 40 | RollbarCrashMonitorAPI* rcm_system_getAPI(void); 41 | 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarDTO+CustomData.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarDTO_CustomData_h 2 | #define RollbarDTO_CustomData_h 3 | 4 | #import "RollbarDTO.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// Adds custom data manipulation methods to a DTO 9 | @interface RollbarDTO (CustomData) 10 | 11 | #pragma mark - Non-safe operations 12 | 13 | /// Add custom data value by a key 14 | /// @param aKey the key 15 | /// @param aValue the custom data 16 | - (void)addKeyed:(NSString *)aKey DataTransferObject:(RollbarDTO *)aValue; 17 | 18 | /// Add custom data value by a key 19 | /// @param aKey the key 20 | /// @param aValue the custom data 21 | - (void)addKeyed:(NSString *)aKey String:(NSString *)aValue; 22 | 23 | /// Add custom data value by a key 24 | /// @param aKey the key 25 | /// @param aValue the custom data 26 | - (void)addKeyed:(NSString *)aKey Number:(NSNumber *)aValue; 27 | 28 | /// Add custom data value by a key 29 | /// @param aKey the key 30 | /// @param aValue the custom data 31 | - (void)addKeyed:(NSString *)aKey Array:(NSArray *)aValue; 32 | 33 | /// Add custom data value by a key 34 | /// @param aKey the key 35 | /// @param aValue the custom data 36 | - (void)addKeyed:(NSString *)aKey Dictionary:(NSDictionary *)aValue; 37 | 38 | /// Add custom data value by a key 39 | /// @param aKey the key 40 | /// @param aValue the custom data 41 | - (void)addKeyed:(NSString *)aKey Placeholder:(NSNull *)aValue; 42 | 43 | #pragma mark - Safe operations 44 | 45 | /// Tries adding a custom data by a key value 46 | /// @param aKey the key to use 47 | /// @param aValue the data to add 48 | - (BOOL)tryAddKeyed:(NSString *)aKey Object:(NSObject *)aValue; 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | 54 | #endif //RollbarDTO_CustomData_h 55 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/include/RollbarPayloadTruncator.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarPayloadTruncator_h 2 | #define RollbarPayloadTruncator_h 3 | 4 | @import Foundation; 5 | 6 | /// Payload truncation utility 7 | @interface RollbarPayloadTruncator : NSObject 8 | 9 | /// Truncates a provided payload 10 | /// @param payload the payload to truncate 11 | +(void)truncatePayload:(NSMutableDictionary *)payload; 12 | 13 | /// Truncates multiple payloads to provided byte size 14 | /// @param payloads payloads to truncate 15 | /// @param maxByteSize max payload byte sixe to achieve 16 | +(void)truncatePayloads:(NSArray *)payloads 17 | toMaxByteSize:(unsigned long)maxByteSize; 18 | 19 | /// Truncates a payload to a total bytes limit 20 | /// @param payload a payload to truncate 21 | /// @param limit total bytes limit to truncate to 22 | +(void)truncatePayload:(NSMutableDictionary *)payload 23 | toTotalBytes:(unsigned long) limit; 24 | 25 | /// Measures byte size of a string using specified encoding 26 | /// @param string a string to measure 27 | /// @param encoding string encoding to use 28 | +(unsigned long)measureTotalEncodingBytes:(NSString *)string 29 | usingEncoding:(NSStringEncoding)encoding; 30 | 31 | /// Measures byte size of a string using default encoding 32 | /// @param string a string to measure 33 | +(unsigned long)measureTotalEncodingBytes:(NSString *)string; 34 | 35 | /// Truncates a string to a total bytes limit 36 | /// @param inputString a string to truncate 37 | /// @param totalBytesLimit a limit to truncate to 38 | +(NSString*)truncateString:(NSString *)inputString 39 | toTotalBytes:(unsigned long)totalBytesLimit; 40 | 41 | @end 42 | 43 | #endif //RollbarPayloadTruncator_h 44 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Util/RollbarCrashID.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashID.h 3 | // 4 | // Copyright (c) 2016 Karl Stenerud. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall remain in place 14 | // in this source code. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | #ifndef HDR_RollbarCrashID_h 26 | #define HDR_RollbarCrashID_h 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | 33 | /** Generate a new human readabale, null terminated, globally unique ID string. 34 | * 35 | * @param destinationBuffer37Bytes Buffer of at least 37 bytes to hold the ID. 36 | */ 37 | void rcid_generate(char* destinationBuffer37Bytes); 38 | 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif // HDR_RollbarCrashID_h 45 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.7.1 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "RollbarCocoaLumberjack", 7 | platforms: [ 8 | .macOS(.v10_13), 9 | .iOS(.v11), 10 | .tvOS(.v11), 11 | .watchOS(.v4), 12 | ], 13 | products: [ 14 | .library( 15 | name: "RollbarCocoaLumberjack", 16 | targets: ["RollbarCocoaLumberjack"] 17 | ), 18 | ], 19 | dependencies: [ 20 | .package(path: "../RollbarCommon"), 21 | .package(path: "../RollbarNotifier"), 22 | .package(path: "../UnitTesting"), 23 | .package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", from: "3.8.0"), 24 | ], 25 | targets: [ 26 | .target( 27 | name: "RollbarCocoaLumberjack", 28 | dependencies: [ 29 | "RollbarCommon", 30 | "RollbarNotifier", 31 | "CocoaLumberjack", 32 | ], 33 | path: "Sources/RollbarCocoaLumberjack" 34 | ), 35 | .testTarget( 36 | name: "RollbarCocoaLumberjackTests", 37 | dependencies: [ 38 | "UnitTesting", 39 | "CocoaLumberjack", 40 | "RollbarCocoaLumberjack", 41 | .product(name: "CocoaLumberjackSwift", package: "CocoaLumberjack", condition: nil), 42 | ] 43 | ), 44 | .testTarget( 45 | name: "RollbarCocoaLumberjackTests-ObjC", 46 | dependencies: ["UnitTesting", "RollbarCocoaLumberjack"], 47 | path: "Tests/RollbarCocoaLumberjackTests-ObjC" 48 | ), 49 | ], 50 | swiftLanguageVersions: [ 51 | SwiftVersion.v5, 52 | ] 53 | ) 54 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Util/RollbarCrashCxaThrowSwapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashCxaThrowSwapper.h 3 | // 4 | // Copyright (c) 2019 YANDEX LLC. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall remain in place 14 | // in this source code. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | #ifndef RollbarCrashCxaThrowSwapper_h 26 | #define RollbarCrashCxaThrowSwapper_h 27 | 28 | #ifdef __cplusplus 29 | 30 | #include 31 | 32 | extern "C" { 33 | 34 | typedef void (*cxa_throw_type)(void *, std::type_info *, void (*)(void *)); 35 | #else 36 | typedef void (*cxa_throw_type)(void *, void *, void (*)(void *)); 37 | #endif 38 | 39 | int rcct_swap(const cxa_throw_type handler); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* RollbarCrashCxaThrowSwapper_h */ 46 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/RollbarPayloadFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarPayloadFactory.h 3 | // 4 | // 5 | // Created by Andrey Kornich on 2022-06-14. 6 | // 7 | 8 | #import 9 | 10 | #import "RollbarLevel.h" 11 | 12 | @class RollbarConfig; 13 | @class RollbarPayload; 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface RollbarPayloadFactory : NSObject 18 | 19 | - (nullable RollbarPayload *)payloadWithLevel:(RollbarLevel)level 20 | crashReport:(nonnull NSString *)crashReport; 21 | 22 | - (nullable RollbarPayload *)payloadWithLevel:(RollbarLevel)level 23 | message:(nonnull NSString *)message 24 | data:(nullable NSDictionary *)data 25 | context:(nullable NSString *)context; 26 | 27 | - (nullable RollbarPayload *)payloadWithLevel:(RollbarLevel)level 28 | exception:(nonnull NSException *)exception 29 | data:(nullable NSDictionary *)data 30 | context:(nullable NSString *)context; 31 | 32 | - (nullable RollbarPayload *)payloadWithLevel:(RollbarLevel)level 33 | error:(nonnull NSError *)error 34 | data:(nullable NSDictionary *)data 35 | context:(nullable NSString *)context; 36 | 37 | - (instancetype)initWithConfig:(nonnull RollbarConfig *)config NS_DESIGNATED_INITIALIZER; 38 | - (instancetype)init NS_UNAVAILABLE; 39 | 40 | + (instancetype)factoryWithConfig:(nonnull RollbarConfig *)config; 41 | 42 | @end 43 | 44 | NS_ASSUME_NONNULL_END 45 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarModule.m: -------------------------------------------------------------------------------- 1 | #import "RollbarModule.h" 2 | 3 | #pragma mark - constants 4 | 5 | static NSString *const DEFAULT_VERSION = nil; 6 | 7 | #pragma mark - data field keys 8 | 9 | static NSString * const DFK_NAME = @"name"; 10 | static NSString * const DFK_VERSION = @"version"; 11 | 12 | #pragma mark - class implementation 13 | 14 | @implementation RollbarModule 15 | 16 | #pragma mark - initializers 17 | 18 | - (instancetype)initWithName:(nullable NSString *)name 19 | version:(nullable NSString *)version { 20 | 21 | if (self = [super initWithDictionary:@{ 22 | DFK_NAME:name ? name : [NSNull null], 23 | DFK_VERSION:version ? version : [NSNull null] 24 | }]) { 25 | return self; 26 | } 27 | 28 | return nil;; 29 | } 30 | 31 | - (instancetype)initWithName:(nullable NSString *)name { 32 | 33 | return [self initWithName:name version:DEFAULT_VERSION]; 34 | } 35 | 36 | #pragma mark - property accessors 37 | 38 | - (nullable NSString *)name { 39 | return [self getDataByKey:DFK_NAME]; 40 | } 41 | 42 | - (nullable NSString *)version { 43 | return [self getDataByKey:DFK_VERSION]; 44 | } 45 | 46 | @end 47 | 48 | 49 | @implementation RollbarMutableModule 50 | 51 | #pragma mark - initializers 52 | 53 | -(instancetype)init { 54 | 55 | if (self = [super initWithDictionary:@{}]) { 56 | return self; 57 | } 58 | return nil; 59 | } 60 | 61 | #pragma mark - property accessors 62 | 63 | @dynamic name; 64 | @dynamic version; 65 | 66 | - (void)setName:(nullable NSString *)value { 67 | [self setData:value byKey:DFK_NAME]; 68 | } 69 | 70 | - (void)setVersion:(nullable NSString *)value { 71 | [self setData:value byKey:DFK_VERSION]; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /RollbarCocoaLumberjack.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "RollbarCocoaLumberjack" 3 | s.version = "3.3.3" 4 | s.summary = "Application or client side SDK for interacting with the Rollbar API Server." 5 | s.description = <<-DESC 6 | Find, fix, and resolve errors with Rollbar. 7 | Easily send error data using Rollbar API. 8 | Analyze, de-dupe, send alerts, and prepare the data for further analysis. 9 | Search, sort, and prioritize via the Rollbar dashboard. 10 | DESC 11 | s.homepage = "https://rollbar.com" 12 | s.resource = "rollbar-logo.png" 13 | s.license = { :type => "MIT", :file => "LICENSE" } 14 | s.authors = { "Rollbar" => "support@rollbar.com" } 15 | s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", 16 | :tag => s.version.to_s } 17 | s.documentation_url = "https://docs.rollbar.com/docs/apple" 18 | s.social_media_url = "https://twitter.com/rollbar" 19 | 20 | s.osx.deployment_target = "10.13" 21 | s.ios.deployment_target = "11.0" 22 | s.tvos.deployment_target = "11.0" 23 | s.watchos.deployment_target = "4.0" 24 | 25 | s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" 26 | s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" 27 | s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" 28 | 29 | s.static_framework = true 30 | s.framework = "Foundation" 31 | s.dependency "RollbarCommon", "~> #{s.version}" 32 | s.dependency "RollbarNotifier", "~> #{s.version}" 33 | s.dependency "CocoaLumberjack", "~> 3.8.0" 34 | 35 | s.swift_versions = "5.5" 36 | s.requires_arc = true 37 | end 38 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashCachedData.h 3 | // 4 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall remain in place 14 | // in this source code. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | 26 | /* Maintains a cache of difficult-to-retrieve data. 27 | */ 28 | 29 | 30 | #include "RollbarCrashThread.h" 31 | 32 | void rcccd_init(int pollingIntervalInSeconds); 33 | 34 | void rcccd_freeze(void); 35 | void rcccd_unfreeze(void); 36 | 37 | void rcccd_setSearchQueueNames(bool searchQueueNames); 38 | 39 | RollbarCrashThread* rcccd_getAllThreads(int* threadCount); 40 | 41 | const char* rcccd_getThreadName(RollbarCrashThread thread); 42 | 43 | const char* rcccd_getQueueName(RollbarCrashThread thread); 44 | -------------------------------------------------------------------------------- /Examples/RollbarObjCDemo/RollbarObjCDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Monitors/RollbarCrashMonitor_Signal.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashMonitor_Signal.h 3 | // 4 | // Created by Karl Stenerud on 2012-01-28. 5 | // 6 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall remain in place 16 | // in this source code. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | 28 | /* Catches fatal unix signals. 29 | */ 30 | 31 | 32 | #ifndef HDR_RollbarCrashMonitor_Signal_h 33 | #define HDR_RollbarCrashMonitor_Signal_h 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | #include "RollbarCrashMonitor.h" 41 | 42 | 43 | /** Access the Monitor API. 44 | */ 45 | RollbarCrashMonitorAPI* rcm_signal_getAPI(void); 46 | 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif // HDR_RollbarCrashMonitor_Signal_h 53 | -------------------------------------------------------------------------------- /RollbarCommon/Sources/RollbarCommon/include/RollbarJSONSupport.h: -------------------------------------------------------------------------------- 1 | #ifndef RollbarJSONSupport_h 2 | #define RollbarJSONSupport_h 3 | 4 | @import Foundation; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | /// JSON de/serialization protocol 9 | @protocol RollbarJSONSupport 10 | 11 | /// Internal JSON serializable "data store" 12 | @property (readonly) NSMutableDictionary *jsonFriendlyData; 13 | 14 | #pragma mark - via JSON-friendly NSData 15 | 16 | /// Serialize into JSON-friendly NSData instance 17 | - (nullable NSData *)serializeToJSONData; 18 | 19 | /// Desrialize from JSON-friendly NSData instance 20 | /// @param jsonData JSON-friendly NSData instance 21 | - (BOOL)deserializeFromJSONData:(NSData *)jsonData; 22 | 23 | #pragma mark - via JSON string 24 | 25 | /// Serialize into a JSON string 26 | - (nullable NSString *)serializeToJSONString; 27 | 28 | /// Deserialize from a JSON string 29 | /// @param jsonString JSON string 30 | - (BOOL)deserializeFromJSONString:(NSString *)jsonString; 31 | 32 | #pragma mark - Initializers 33 | 34 | /// Initialize this DTO instance with valid JSON data string seed 35 | /// @param jsonString valid JSON data string seed 36 | - (instancetype)initWithJSONString:(NSString *)jsonString; 37 | 38 | /// Initialize this DTO instance with valid JSON NSData seed 39 | /// @param data valid JSON NSData seed 40 | - (instancetype)initWithJSONData:(NSData *)data; 41 | 42 | /// Initialize this DTO instance with valid JSON NSDictionary seed 43 | /// @param data valid JSON NSDictionary seed 44 | - (instancetype)initWithDictionary:(NSDictionary *)data; 45 | 46 | /// Initialize this DTO instance with valid JSON NSArray seed 47 | /// @param data valid JSON NSArray seed 48 | - (instancetype)initWithArray:(NSArray *)data; 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | 54 | #endif //RollbarJSONSupport_h 55 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Monitors/RollbarCrashMonitor_CPPException.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashMonitor_CPPException.h 3 | // 4 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall remain in place 14 | // in this source code. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | #ifndef HDR_RollbarCrashMonitor_CPPException_h 26 | #define HDR_RollbarCrashMonitor_CPPException_h 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | #include "RollbarCrashMonitor.h" 33 | 34 | /** Enable swapping of __cxa_trow symbol with lazy symbols table 35 | */ 36 | void rcm_enableSwapCxaThrow(void); 37 | 38 | /** Access the Monitor API. 39 | */ 40 | RollbarCrashMonitorAPI* rcm_cppexception_getAPI(void); 41 | 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif // HDR_RollbarCrashMonitor_CPPException_h 48 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarException.m: -------------------------------------------------------------------------------- 1 | #import "RollbarException.h" 2 | 3 | static NSString * const DFK_CLASS = @"class"; 4 | static NSString * const DFK_MESSAGE = @"message"; 5 | static NSString * const DFK_DESCRIPTION = @"description"; 6 | 7 | @implementation RollbarException 8 | 9 | #pragma mark - Properties 10 | 11 | - (nonnull NSString *)exceptionClass { 12 | 13 | NSString *result = [self getDataByKey:DFK_CLASS]; 14 | return (nil != result) ? result : @""; 15 | } 16 | 17 | - (void)setExceptionClass:(nonnull NSString *)exceptionClass { 18 | 19 | [self setData:exceptionClass byKey:DFK_CLASS]; 20 | } 21 | 22 | - (nullable NSString *)exceptionMessage { 23 | 24 | return [self getDataByKey:DFK_MESSAGE]; 25 | } 26 | 27 | - (void)setExceptionMessage:(nullable NSString *)exceptionMessage { 28 | [self setData:exceptionMessage byKey:DFK_MESSAGE]; 29 | } 30 | 31 | - (nullable NSString *)exceptionDescription { 32 | 33 | return [self getDataByKey:DFK_DESCRIPTION]; 34 | } 35 | 36 | - (void)setExceptionDescription:(nullable NSString *)exceptionDescription { 37 | 38 | [self setData:exceptionDescription byKey:DFK_DESCRIPTION]; 39 | } 40 | 41 | #pragma mark - Initializers 42 | 43 | - (instancetype)initWithExceptionClass:(nonnull NSString *)exceptionClass 44 | exceptionMessage:(nullable NSString *)exceptionMessage 45 | exceptionDescription:(nullable NSString *)exceptionDescription { 46 | 47 | self = [super initWithDictionary:@{ 48 | 49 | DFK_CLASS: exceptionClass ? exceptionClass : [NSNull null], 50 | DFK_MESSAGE: exceptionMessage ? exceptionMessage : [NSNull null], 51 | DFK_DESCRIPTION: exceptionDescription ? exceptionDescription : [NSNull null] 52 | }]; 53 | 54 | return self; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Monitors/RollbarCrashMonitor_NSException.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashMonitor_NSException.h 3 | // 4 | // Created by Karl Stenerud on 2012-01-28. 5 | // 6 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall remain in place 16 | // in this source code. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | 28 | /* Catches Objective-C exceptions. 29 | */ 30 | 31 | 32 | #ifndef HDR_RollbarCrashMonitor_NSException_h 33 | #define HDR_RollbarCrashMonitor_NSException_h 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | #include "RollbarCrashMonitor.h" 41 | 42 | 43 | /** Access the Monitor API. 44 | */ 45 | RollbarCrashMonitorAPI* rcm_nsexception_getAPI(void); 46 | 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif // HDR_RollbarCrashMonitor_NSException_h 53 | -------------------------------------------------------------------------------- /RollbarNotifier/Sources/RollbarCrash/Util/RollbarCrashDebug.h: -------------------------------------------------------------------------------- 1 | // 2 | // RollbarCrashDebug.h 3 | // 4 | // Created by Karl Stenerud on 2012-01-29. 5 | // 6 | // Copyright (c) 2012 Karl Stenerud. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall remain in place 16 | // in this source code. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | 28 | /* Utility functions for querying the mach kernel. 29 | */ 30 | 31 | 32 | #ifndef HDR_RollbarCrashDebug_h 33 | #define HDR_RollbarCrashDebug_h 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | #include 41 | 42 | 43 | /** Check if the current process is being traced or not. 44 | * 45 | * @return true if we're being traced. 46 | */ 47 | bool rcdebug_isBeingTraced(void); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif // HDR_RollbarCrashDebug_h 54 | --------------------------------------------------------------------------------