From 4a4582bc39a7c87900a62bd00cd4d3667d6609ff Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 3 Mar 2021 22:02:09 -0800 Subject: [PATCH 01/11] gitflow-feature-stash: RollbarSwift feat: allocated RollbarSwift project --- .../contents.xcworkspacedata | 3 + RollbarSwift/.gitignore | 5 + .../xcschemes/RollbarSwift.xcscheme | 101 ++++++++++++++++++ RollbarSwift/Package.swift | 72 +++++++++++++ RollbarSwift/README.md | 3 + .../Sources/RollbarSwift/RollbarSwift.swift | 3 + RollbarSwift/Tests/LinuxMain.swift | 7 ++ .../RollbarSwiftTests.m | 16 +++ .../RollbarSwiftTests/RollbarSwiftTests.swift | 15 +++ .../RollbarSwiftTests/XCTestManifests.swift | 9 ++ 10 files changed, 234 insertions(+) create mode 100644 RollbarSwift/.gitignore create mode 100644 RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme create mode 100644 RollbarSwift/Package.swift create mode 100644 RollbarSwift/README.md create mode 100644 RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift create mode 100644 RollbarSwift/Tests/LinuxMain.swift create mode 100644 RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m create mode 100644 RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift create mode 100644 RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift diff --git a/RollbarSDK.xcworkspace/contents.xcworkspacedata b/RollbarSDK.xcworkspace/contents.xcworkspacedata index da44fc63..0e8178e8 100644 --- a/RollbarSDK.xcworkspace/contents.xcworkspacedata +++ b/RollbarSDK.xcworkspace/contents.xcworkspacedata @@ -56,6 +56,9 @@ + + diff --git a/RollbarSwift/.gitignore b/RollbarSwift/.gitignore new file mode 100644 index 00000000..95c43209 --- /dev/null +++ b/RollbarSwift/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ diff --git a/RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme b/RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme new file mode 100644 index 00000000..028e5fa8 --- /dev/null +++ b/RollbarSwift/.swiftpm/xcode/xcshareddata/xcschemes/RollbarSwift.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RollbarSwift/Package.swift b/RollbarSwift/Package.swift new file mode 100644 index 00000000..0c170316 --- /dev/null +++ b/RollbarSwift/Package.swift @@ -0,0 +1,72 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "RollbarSwift", + platforms: [ + // Oldest targeted platform versions that are supported by this product. + .macOS(.v10_10), + .iOS(.v9), + .tvOS(.v11), + .watchOS(.v4), + ], + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "RollbarSwift", + targets: ["RollbarSwift"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + .package(path: "../RollbarCommon"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "RollbarSwift", + dependencies: ["RollbarCommon",], + publicHeadersPath: "include", + cSettings: [ + .headerSearchPath("Sources/RollbarSwift/**"), +// .headerSearchPath("Sources/RollbarSwift"), +// .headerSearchPath("Sources/RollbarSwift/include"), +// .headerSearchPath("Sources/RollbarSwift/DTOs"), + +// .define("DEFINES_MODULE"), + ] + ), + .testTarget( + name: "RollbarSwiftTests", + dependencies: ["RollbarSwift"], + cSettings: [ + .headerSearchPath("Tests/RollbarSwiftTests/**"), +// .headerSearchPath("Sources/RollbarNotifier"), +// .headerSearchPath("Sources/RollbarNotifier/include"), +// .headerSearchPath("Sources/RollbarNotifier/DTOs"), + +// .define("DEFINES_MODULE"), + ] + ), + .testTarget( + name: "RollbarSwiftTests-ObjC", + dependencies: ["RollbarSwift"], + cSettings: [ + .headerSearchPath("Tests/RollbarSwiftTests-ObjC/**"), +// .headerSearchPath("Sources/RollbarNotifier"), +// .headerSearchPath("Sources/RollbarNotifier/include"), +// .headerSearchPath("Sources/RollbarNotifier/DTOs"), + +// .define("DEFINES_MODULE"), + ] + ), + ], + swiftLanguageVersions: [ + SwiftVersion.v4, + SwiftVersion.v4_2, + SwiftVersion.v5, + ] +) diff --git a/RollbarSwift/README.md b/RollbarSwift/README.md new file mode 100644 index 00000000..cc67fbdc --- /dev/null +++ b/RollbarSwift/README.md @@ -0,0 +1,3 @@ +# RollbarSwift + +This is an SDK module implementing functionality and features specifically useful to Swift-based client code. diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift b/RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift new file mode 100644 index 00000000..e31b9e72 --- /dev/null +++ b/RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift @@ -0,0 +1,3 @@ +struct RollbarSwift { + var text = "Hello, World!" +} diff --git a/RollbarSwift/Tests/LinuxMain.swift b/RollbarSwift/Tests/LinuxMain.swift new file mode 100644 index 00000000..2138c249 --- /dev/null +++ b/RollbarSwift/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import RollbarSwiftTests + +var tests = [XCTestCaseEntry]() +tests += RollbarSwiftTests.allTests() +XCTMain(tests) diff --git a/RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m b/RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m new file mode 100644 index 00000000..4cdf040b --- /dev/null +++ b/RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m @@ -0,0 +1,16 @@ +// Copyright (c) 2018 Rollbar, Inc. All rights reserved. + +#import + +@import RollbarSwift; + +@interface RollbarSwiftTests : XCTestCase +@end + +@implementation RollbarSwiftTests + +- (void)testBasics { +} + +@end + diff --git a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift new file mode 100644 index 00000000..77aa544d --- /dev/null +++ b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift @@ -0,0 +1,15 @@ +import XCTest +@testable import RollbarSwift + +final class RollbarSwiftTests: XCTestCase { + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(RollbarSwift().text, "Hello, World!") + } + + static var allTests = [ + ("testExample", testExample), + ] +} diff --git a/RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift b/RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift new file mode 100644 index 00000000..9cb1daf7 --- /dev/null +++ b/RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !canImport(ObjectiveC) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(RollbarSwiftTests.allTests), + ] +} +#endif From 53a462a3a102135b2c36481e8df9cc936c19022d Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 3 Mar 2021 22:54:21 -0800 Subject: [PATCH 02/11] feat: completed RollbarSwift project setup --- .github/workflows/masterCI.yml | 23 ++++++- CHANGELOG.md | 9 ++- Package.swift | 12 ++++ RollbarSDK.experimental_podspec | 40 +++++++++++ .../contents.xcworkspacedata | 9 +++ RollbarSwift.podspec | 69 +++++++++++++++++++ 6 files changed, 158 insertions(+), 4 deletions(-) create mode 100644 RollbarSwift.podspec diff --git a/.github/workflows/masterCI.yml b/.github/workflows/masterCI.yml index d40ff95b..a7f9099e 100644 --- a/.github/workflows/masterCI.yml +++ b/.github/workflows/masterCI.yml @@ -58,6 +58,13 @@ jobs: # working-directory: RollbarPLCrashReporter # run: swift test -v --enable-test-discovery --enable-code-coverage --build-path ../DerivedData + - name: Build RollbarSwift + working-directory: RollbarSwift + run: swift build -v + #- name: Unit Test RollbarSwift + # working-directory: RollbarSwift + # run: swift test -v --enable-test-discovery --enable-code-coverage --build-path ../DerivedData + # - name: Unit Test RollbarCommon # working-directory: RollbarCommon # run: ../SonarCloud/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir ../DerivedData/compilation-database @@ -77,7 +84,6 @@ jobs: CODE_SIGNING_REQUIRED=NO # clean build - - name: SonarCloud RollbarDeploys run: SonarCloud/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir DerivedData/compilation-database xcodebuild @@ -130,6 +136,19 @@ jobs: CODE_SIGNING_REQUIRED=NO # clean build + - name: SonarCloud RollbarSwift + run: SonarCloud/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir DerivedData/compilation-database + xcodebuild + -workspace RollbarSDK.xcworkspace + -scheme RollbarSwift + -derivedDataPath DerivedData + -enableCodeCoverage YES + build + test + CODE_SIGN_IDENTITY="-" + CODE_SIGNING_REQUIRED=NO + # clean build + - name: SonarCloud Test Coverage Conversion run: bash xccov-to-sonarqube-generic.sh DerivedData/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml @@ -175,7 +194,7 @@ jobs: # run: swift test -v -# Fron SonarCCloud Docs: +# From SonarCCloud Docs: # Execute the Build Wrapper as a prefix to your build command: # build-wrapper-macosx-x86 --out-dir bw-output diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d8cdce4..a6bb8632 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,11 +25,16 @@ The change log has moved to this repo's [GitHub Releases Page](https://github.co ## Release Notes -**2.0.0** Preliminary Notes +**2.0.0-beta3** +- feat: added RollbarSwift + +**2.0.0-beta2** +- feat: added new developer option: suppressSdkInfoLogging + +**2.0.0-beta1** - comparing to Rollbar-iOS - feat: added RollbarPLCrashReporter module - feat: added RollbarKSCrash module - feat: added explicit reporting of NSErrors -- feat: added new developer option: suppressSdkInfoLogging - feat: defined default scrub fields - refactor: split out RollbarCommon, RollbarNotifier, RollbarDeploys - refactor: added use of lightweight generics diff --git a/Package.swift b/Package.swift index de35d7bf..a34faa3e 100644 --- a/Package.swift +++ b/Package.swift @@ -29,6 +29,9 @@ let package = Package( .library( name: "RollbarPLCrashReporter", targets: ["RollbarPLCrashReporter"]), + .library( + name: "RollbarSwift", + targets: ["RollbarSwift"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -95,6 +98,15 @@ let package = Package( ] ), + .target( + name: "RollbarSwift", + dependencies: ["RollbarCommon",], + publicHeadersPath: "include", + cSettings: [ + .headerSearchPath("RollbarSwift/Sources/RollbarSwift/**"), + ] + ), + ], swiftLanguageVersions: [ SwiftVersion.v4, diff --git a/RollbarSDK.experimental_podspec b/RollbarSDK.experimental_podspec index 57b51a3b..c9cb6ecf 100644 --- a/RollbarSDK.experimental_podspec +++ b/RollbarSDK.experimental_podspec @@ -234,4 +234,44 @@ Pod::Spec.new do |sdk| plcrash.tvos.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } end + # RollbarSwift module: + # ===================== + sdk.subspec "RollbarSwift" do |swift| + swift.name = "RollbarSwift" + + # Any platform, if omitted: + # swift.platform = :ios + # swift.platform = :ios, "5.0" + + # When using multiple platforms: + # swift.ios.deployment_target = "9.0" + # swift.osx.deployment_target = "10.10" + # swift.tvos.deployment_target = "11.0" + # swift.watchos.deployment_target = "4.0" + + swift.source_files = "RollbarSwift/Sources/RollbarSwift/**/*.{h,m}" + # swift.exclude_files = "Classes/Exclude" + swift.public_header_files = "RollbarSwift/Sources/RollbarSwift/include/*.h" + # swift.module_map = "RollbarSwift/Sources/RollbarSwift/include/module.modulemap" + # swift.resource = "../rollbar-logo.png" + # swift.resources = "Resources/*.png" + # swift.preserve_paths = "FilesToSave", "MoreFilesToSave" + + swift.dependency "RollbarSDK/RollbarCommon" + swift.framework = "Foundation" + # swift.frameworks = "SomeFramework", "AnotherFramework" + # swift.library = "iconv" + # swift.libraries = "iconv", "xml2" + # swift.dependency "JSONKit", "~> 1.4" + swift.requires_arc = true + # swift.xcconfig = { + # "USE_HEADERMAP" => "NO", + # "HEADER_SEARCH_PATHS" => "$(PODS_ROOT)/Sources/RollbarSwift/**" + # } + swift.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } + swift.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } + swift.tvos.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } + swift.tvos.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } + end + end diff --git a/RollbarSDK.xcworkspace/contents.xcworkspacedata b/RollbarSDK.xcworkspace/contents.xcworkspacedata index 0e8178e8..aa9d279a 100644 --- a/RollbarSDK.xcworkspace/contents.xcworkspacedata +++ b/RollbarSDK.xcworkspace/contents.xcworkspacedata @@ -4,6 +4,12 @@ + + + + @@ -37,6 +43,9 @@ + + diff --git a/RollbarSwift.podspec b/RollbarSwift.podspec new file mode 100644 index 00000000..0d69289f --- /dev/null +++ b/RollbarSwift.podspec @@ -0,0 +1,69 @@ +# +# Be sure to run `pod spec lint RollbarSDK.podspec' to ensure this is a valid spec. +# +# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ +# + +Pod::Spec.new do |s| + + s.version = "2.0.0-beta2" + s.name = "RollbarSwift" + s.summary = "Application or client side SDK for interacting with the Rollbar API Server." + s.description = <<-DESC + Find, fix, and resolve errors with Rollbar. + Easily send error data using Rollbar API. + Analyze, de-dupe, send alerts, and prepare the data for further analysis. + Search, sort, and prioritize via the Rollbar dashboard. + DESC + s.homepage = "https://rollbar.com" + # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" + s.license = { :type => "MIT", :file => "LICENSE" } + # s.license = "MIT (example)" + s.documentation_url = "https://docs.rollbar.com/docs/ios" + s.authors = { "Andrey Kornich (Wide Spectrum Computing LLC)" => "akornich@gmail.com", + "Rollbar" => "support@rollbar.com" } + # s.author = { "Andrey Kornich" => "akornich@gmail.com" } + # Or just: s.author = "Andrey Kornich" + s.social_media_url = "http://twitter.com/rollbar" + s.source = { :git => "https://github.com/rollbar/rollbar-apple.git", + :tag => "v#{s.version}" + } + s.resource = "rollbar-logo.png" + # s.resources = "Resources/*.png" + + # When using multiple platforms: + s.ios.deployment_target = "9.0" + s.osx.deployment_target = "10.10" + s.tvos.deployment_target = "11.0" + # s.watchos.deployment_target = "4.0" + # Any platform, if omitted: + # s.platform = :ios + # s.platform = :ios, "5.0" + + s.source_files = "#{s.name}/Sources/#{s.name}/**/*.{h,m}" + s.public_header_files = "#{s.name}/Sources/#{s.name}/include/*.h" + s.module_map = "#{s.name}/Sources/#{s.name}/include/module.modulemap" + # s.exclude_files = "Classes/Exclude" + # s.preserve_paths = "FilesToSave", "MoreFilesToSave" + + s.framework = "Foundation" + s.dependency "RollbarCommon", "~> #{s.version}" + # s.frameworks = "SomeFramework", "AnotherFramework" + # s.library = "iconv" + # s.libraries = "iconv", "xml2" + # s.dependency "JSONKit", "~> 1.4" + + s.requires_arc = true + # s.xcconfig = { + # "USE_HEADERMAP" => "NO", + # "HEADER_SEARCH_PATHS" => "$(PODS_ROOT)/Sources/#{s.name}/**" + # } + + s.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } + s.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "arm64" } + + s.tvos.pod_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } + s.tvos.user_target_xcconfig = { "ONLY_ACTIVE_ARCH" => "YES", "EXCLUDED_ARCHS[sdk=appletvsimulator*]" => "arm64" } + +end From 20c6d0f0119bcb6d52dcf83caedc9d97b7e022ac Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Fri, 5 Mar 2021 15:43:20 -0800 Subject: [PATCH 03/11] feat: [WIP] implementing RollbarSwift --- Package.swift | 2 +- RollbarSwift/Package.swift | 3 +- .../RollbarSwift/RollbarExceptionGuard.m | 93 +++++++++++++++++++ .../Sources/RollbarSwift/RollbarSwift.swift | 3 - .../Sources/RollbarSwift/RollbarTryCatch.m | 65 +++++++++++++ .../include/RollbarExceptionGuard.h | 29 ++++++ .../RollbarSwift/include/RollbarTryCatch.h | 52 +++++++++++ .../RollbarSwift/include/module.modulemap | 8 ++ 8 files changed, 250 insertions(+), 5 deletions(-) create mode 100644 RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m delete mode 100644 RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift create mode 100644 RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m create mode 100644 RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h create mode 100644 RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h create mode 100644 RollbarSwift/Sources/RollbarSwift/include/module.modulemap diff --git a/Package.swift b/Package.swift index a34faa3e..3ea63de5 100644 --- a/Package.swift +++ b/Package.swift @@ -100,7 +100,7 @@ let package = Package( .target( name: "RollbarSwift", - dependencies: ["RollbarCommon",], + dependencies: ["RollbarCommon", "RollbarNotifier"], publicHeadersPath: "include", cSettings: [ .headerSearchPath("RollbarSwift/Sources/RollbarSwift/**"), diff --git a/RollbarSwift/Package.swift b/RollbarSwift/Package.swift index 0c170316..9024ce69 100644 --- a/RollbarSwift/Package.swift +++ b/RollbarSwift/Package.swift @@ -22,13 +22,14 @@ let package = Package( // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), .package(path: "../RollbarCommon"), + .package(path: "../RollbarNotifier"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "RollbarSwift", - dependencies: ["RollbarCommon",], + dependencies: ["RollbarCommon", "RollbarNotifier",], publicHeadersPath: "include", cSettings: [ .headerSearchPath("Sources/RollbarSwift/**"), diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m new file mode 100644 index 00000000..c74034aa --- /dev/null +++ b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m @@ -0,0 +1,93 @@ +// +// RollbarExceptionGuard.m +// +// +// Created by Andrey Kornich on 2021-03-04. +// + +#import "RollbarExceptionGuard.h" +#import "RollbarTryCatch.h" + +@implementation RollbarExceptionGuard { +@private + RollbarLogger *logger; +} + +-(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))tryBlock + error:(__autoreleasing NSError * _Nullable * _Nullable)error { + + __block BOOL success; + [RollbarTryCatch try:^(void){ + + tryBlock(); + success = YES; + } + catch:^(NSException *exception){ + + error = [self convrtException:exception]; + + if (nil != self->logger) { + + NSDictionary *customData = { + [NSString stringWithFormat:@"%s_%s", RollbarExceptionGuard.className, @"NSError"]: error, + }; + [self->logger log:RollbarLevel_Critical + exception:exception + data:customData + context:RollbarExceptionGuard.className + ]; + [self->logger log:RollbarLevel_Critical + error:error + data:nil + context:RollbarExceptionGuard.className + ]; + } + + success = NO; + } + finally:^{} + ]; + + return success; +} + +-(instancetype)initWithLogger:(nonnull RollbarLogger *)logger { + + self = [super init]; + + if (nil != self) { + + self->logger = logger; + } + + return self; +} + +- (NSError *)convrtException:(nonnull NSException *)exception { + + NSMutableDictionary *userInfo = + [[NSMutableDictionary alloc] init]; + + if (nil != exception.userInfo) { + + userInfo = + [[NSMutableDictionary alloc] initWithDictionary:exception.userInfo]; + } + + if (nil != exception.reason) { + + if (nil != [userInfo.allKeys containsObject:NSLocalizedFailureReasonErrorKey]) { + + [userInfo setObject:exception.reason + forKey:NSLocalizedFailureReasonErrorKey]; + } + } + + NSError *error = [[NSError alloc] initWithDomain:exception.name + code:0 + userInfo:userInfo]; + + return error; +} + +@end diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift b/RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift deleted file mode 100644 index e31b9e72..00000000 --- a/RollbarSwift/Sources/RollbarSwift/RollbarSwift.swift +++ /dev/null @@ -1,3 +0,0 @@ -struct RollbarSwift { - var text = "Hello, World!" -} diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m b/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m new file mode 100644 index 00000000..04b8c318 --- /dev/null +++ b/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m @@ -0,0 +1,65 @@ +// +// RollbarTryCatch.m +// +// +// Created by Andrey Kornich on 2021-03-04. +// + +// +// SwiftTryCatch.h +// +// Created by William Falcon on 10/10/14. +// Copyright (c) 2014 William Falcon. All rights reserved. +// +/* + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + +#import "RollbarTryCatch.h" + +@implementation RollbarTryCatch + ++ (void)try:(__attribute__((noescape)) void(^ _Nullable)(void))try + catch:(__attribute__((noescape)) void(^ _Nullable)(NSException* exception))catch + finally:(__attribute__((noescape)) void(^ _Nullable)(void))finally { + + @try { + if (NULL != try) try(); + } + @catch (NSException *exception) { + if (NULL != catch) { + catch(exception); + } + } + @finally { + if (NULL != finally) { + finally(); + } + } +} + ++ (void)throwString:(NSString*)string { + @throw [NSException exceptionWithName:string reason:string userInfo:nil]; +} + ++ (void)throwException:(NSException*)exception { + @throw exception; +} + +@end diff --git a/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h new file mode 100644 index 00000000..fb01cb3a --- /dev/null +++ b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h @@ -0,0 +1,29 @@ +// +// RollbarExceptionGuard.h +// +// +// Created by Andrey Kornich on 2021-03-04. +// + +#import + +@import RollbarNotifier; + +@class RollbarLogger; + +NS_ASSUME_NONNULL_BEGIN + +@interface RollbarExceptionGuard : NSObject + +-(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))block + error:(__autoreleasing NSError * _Nullable * _Nullable)error; + +-(instancetype)initWithLogger:(nonnull RollbarLogger *)logger +NS_DESIGNATED_INITIALIZER; + +-(instancetype)init +NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h b/RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h new file mode 100644 index 00000000..5993318b --- /dev/null +++ b/RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h @@ -0,0 +1,52 @@ +// +// RollbarTryCatch.h +// +// +// Created by Andrey Kornich on 2021-03-04. +// + +// +// SwiftTryCatch.h +// +// Created by William Falcon on 10/10/14. +// Copyright (c) 2014 William Falcon. All rights reserved. +// +/* + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RollbarTryCatch : NSObject + +/** + Provides try catch functionality for swift by wrapping around Objective-C + */ + ++ (void)try:(__attribute__((noescape)) void(^ _Nullable)(void))try + catch:(__attribute__((noescape)) void(^ _Nullable)(NSException* exception))catch + finally:(__attribute__((noescape)) void(^ _Nullable)(void))finally; + ++ (void)throwString:(NSString*)string; + ++ (void)throwException:(NSException*)exception; + +@end + +NS_ASSUME_NONNULL_END diff --git a/RollbarSwift/Sources/RollbarSwift/include/module.modulemap b/RollbarSwift/Sources/RollbarSwift/include/module.modulemap new file mode 100644 index 00000000..8b671929 --- /dev/null +++ b/RollbarSwift/Sources/RollbarSwift/include/module.modulemap @@ -0,0 +1,8 @@ +module RollbarSwift { + umbrella "." + + export * + module * { export * } + + requires objc +} From ac5c54582b312a685196433d706bb2555554baf1 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Tue, 9 Mar 2021 19:29:22 -0800 Subject: [PATCH 04/11] feat: RollbarSwift implementation in progress --- .../RollbarSwift/RollbarExceptionGuard.m | 21 ++++++++++---- .../include/RollbarExceptionGuard.h | 2 ++ .../RollbarSwiftTests/RollbarSwiftTests.swift | 29 ++++++++++++++++--- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m index c74034aa..67e1cfde 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m @@ -13,10 +13,17 @@ @implementation RollbarExceptionGuard { RollbarLogger *logger; } +-(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))block { + + return [self tryExecute:block error:nil]; +} + -(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))tryBlock error:(__autoreleasing NSError * _Nullable * _Nullable)error { - __block BOOL success; + __block BOOL success = NO; + __block NSError* exceptionError = nil; + [RollbarTryCatch try:^(void){ tryBlock(); @@ -24,12 +31,12 @@ -(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))tryBlock } catch:^(NSException *exception){ - error = [self convrtException:exception]; + exceptionError = [self convrtException:exception]; if (nil != self->logger) { - NSDictionary *customData = { - [NSString stringWithFormat:@"%s_%s", RollbarExceptionGuard.className, @"NSError"]: error, + NSDictionary *customData = @{ + [NSString stringWithFormat:@"%@_%@", RollbarExceptionGuard.className, @"NSError"]: exceptionError, }; [self->logger log:RollbarLevel_Critical exception:exception @@ -37,7 +44,7 @@ -(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))tryBlock context:RollbarExceptionGuard.className ]; [self->logger log:RollbarLevel_Critical - error:error + error:exceptionError data:nil context:RollbarExceptionGuard.className ]; @@ -48,6 +55,8 @@ -(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))tryBlock finally:^{} ]; + *error = exceptionError; + return success; } @@ -76,7 +85,7 @@ - (NSError *)convrtException:(nonnull NSException *)exception { if (nil != exception.reason) { - if (nil != [userInfo.allKeys containsObject:NSLocalizedFailureReasonErrorKey]) { + if (YES == [userInfo.allKeys containsObject:NSLocalizedFailureReasonErrorKey]) { [userInfo setObject:exception.reason forKey:NSLocalizedFailureReasonErrorKey]; diff --git a/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h index fb01cb3a..6e9851a4 100644 --- a/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h +++ b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h @@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN @interface RollbarExceptionGuard : NSObject +-(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))block; + -(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))block error:(__autoreleasing NSError * _Nullable * _Nullable)error; diff --git a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift index 77aa544d..e3981d43 100644 --- a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift +++ b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift @@ -2,11 +2,32 @@ import XCTest @testable import RollbarSwift final class RollbarSwiftTests: XCTestCase { + + func produceObjCException() { + + RollbarTryCatch.throw("Fake NSException"); + } + func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct - // results. - XCTAssertEqual(RollbarSwift().text, "Hello, World!") + + let config = RollbarConfig(); + config.destination.accessToken = "2ffc7997ed864dda94f63e7b7daae0f3"; + config.destination.environment = "unit-tests"; + config.developerOptions.transmit = true; + + let logger = RollbarLogger(configuration: config); + + let exceptionGuard = RollbarExceptionGuard(logger: logger); + + do { + try exceptionGuard.tryExecute { + produceObjCException(); + }; + } catch { + NSLog(error.localizedDescription); + } + + Thread.sleep(forTimeInterval: 5); } static var allTests = [ From 0daa39de24976b81f6e6e47f8f36b5aeb5c6e36c Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 10 Mar 2021 20:13:58 -0800 Subject: [PATCH 05/11] feat: RollbarSwift in progress --- .../RollbarSwift/RollbarExceptionGuard.m | 8 ++-- .../include/RollbarExceptionGuard.h | 10 ++++- .../RollbarSwiftTests/RollbarSwiftTests.swift | 41 +++++++++++++++++-- 3 files changed, 49 insertions(+), 10 deletions(-) diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m index 67e1cfde..e7ae1e54 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m @@ -13,12 +13,12 @@ @implementation RollbarExceptionGuard { RollbarLogger *logger; } --(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))block { - - return [self tryExecute:block error:nil]; +-(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))block { + NSError *error = nil; + return [self execute:block error:&error]; } --(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))tryBlock +-(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))tryBlock error:(__autoreleasing NSError * _Nullable * _Nullable)error { __block BOOL success = NO; diff --git a/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h index 6e9851a4..47be1785 100644 --- a/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h +++ b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h @@ -13,11 +13,17 @@ NS_ASSUME_NONNULL_BEGIN +/// Aids Swift code in handling NSExceptions thrown from within Objective-C calls @interface RollbarExceptionGuard : NSObject --(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))block; +/// Allows to safely execute code that could potentially throw NSExceptions. +/// @param block guarded code block +-(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))block; --(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))block +/// Allows to safely execute code that could potentially throw NSExceptions. +/// @param block guarded code block +/// @param error NSError instance modeling corresponding NSException (if any thown from the guarded code block) +-(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))block error:(__autoreleasing NSError * _Nullable * _Nullable)error; -(instancetype)initWithLogger:(nonnull RollbarLogger *)logger diff --git a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift index e3981d43..c90d312e 100644 --- a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift +++ b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift @@ -3,12 +3,17 @@ import XCTest final class RollbarSwiftTests: XCTestCase { + func safeCode() { + + NSLog("Nothing dangerous here."); + } + func produceObjCException() { RollbarTryCatch.throw("Fake NSException"); } - func testExample() { + func createGuard() -> RollbarExceptionGuard { let config = RollbarConfig(); config.destination.accessToken = "2ffc7997ed864dda94f63e7b7daae0f3"; @@ -18,19 +23,47 @@ final class RollbarSwiftTests: XCTestCase { let logger = RollbarLogger(configuration: config); let exceptionGuard = RollbarExceptionGuard(logger: logger); + + return exceptionGuard; + } + + func testExceptionGuard_tryExecute() { + + let exceptionGuard = createGuard(); + + var success = true; + + success = exceptionGuard.tryExecute { + safeCode(); + } + XCTAssertTrue(success); + + success = exceptionGuard.tryExecute { + produceObjCException(); + } + XCTAssertTrue(!success); + + Thread.sleep(forTimeInterval: 2); + } + + func testExceptionGuard_execute() { + + let exceptionGuard = createGuard(); do { - try exceptionGuard.tryExecute { + try exceptionGuard.execute { produceObjCException(); }; } catch { NSLog(error.localizedDescription); + XCTAssertTrue(error.localizedDescription.contains("Fake NSException")); } - Thread.sleep(forTimeInterval: 5); + Thread.sleep(forTimeInterval: 2); } static var allTests = [ - ("testExample", testExample), + ("testExceptionGuard_tryExecute", testExceptionGuard_tryExecute), + ("testExceptionGuard_execute", testExceptionGuard_execute), ] } From 53126d56b8d9266116d2639ed06d3e882b815fe3 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Wed, 10 Mar 2021 21:27:31 -0800 Subject: [PATCH 06/11] feat: first cut of RollbarSwift --- .../RollbarSwift/RollbarExceptionGuard.m | 4 ++-- .../Sources/RollbarSwift/RollbarTryCatch.m | 22 +++++++++++-------- .../include/RollbarExceptionGuard.h | 3 +++ .../RollbarSwift/include/RollbarTryCatch.h | 19 ++++++++++------ .../RollbarSwiftTests/RollbarSwiftTests.swift | 8 +++++++ 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m index e7ae1e54..d093345c 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m @@ -31,7 +31,7 @@ -(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))tryBlock } catch:^(NSException *exception){ - exceptionError = [self convrtException:exception]; + exceptionError = [self convertException:exception]; if (nil != self->logger) { @@ -72,7 +72,7 @@ -(instancetype)initWithLogger:(nonnull RollbarLogger *)logger { return self; } -- (NSError *)convrtException:(nonnull NSException *)exception { +- (NSError *)convertException:(nonnull NSException *)exception { NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init]; diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m b/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m index 04b8c318..dd340626 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m @@ -35,27 +35,31 @@ of this software and associated documentation files (the "Software"), to deal @implementation RollbarTryCatch -+ (void)try:(__attribute__((noescape)) void(^ _Nullable)(void))try - catch:(__attribute__((noescape)) void(^ _Nullable)(NSException* exception))catch - finally:(__attribute__((noescape)) void(^ _Nullable)(void))finally { ++ (void)try:(__attribute__((noescape)) void(^ _Nullable)(void))tryBlock + catch:(__attribute__((noescape)) void(^ _Nullable)(NSException* exception))catchBlock + finally:(__attribute__((noescape)) void(^ _Nullable)(void))finallyBlock { @try { - if (NULL != try) try(); + if (NULL != tryBlock) tryBlock(); } @catch (NSException *exception) { - if (NULL != catch) { - catch(exception); + if (NULL != catchBlock) { + catchBlock(exception); } } @finally { - if (NULL != finally) { - finally(); + if (NULL != finallyBlock) { + finallyBlock(); } } } + (void)throwString:(NSString*)string { - @throw [NSException exceptionWithName:string reason:string userInfo:nil]; + + NSException *exception = [NSException exceptionWithName:string + reason:string + userInfo:nil]; + [RollbarTryCatch throwException:exception]; } + (void)throwException:(NSException*)exception { diff --git a/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h index 47be1785..3de5d57c 100644 --- a/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h +++ b/RollbarSwift/Sources/RollbarSwift/include/RollbarExceptionGuard.h @@ -26,9 +26,12 @@ NS_ASSUME_NONNULL_BEGIN -(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))block error:(__autoreleasing NSError * _Nullable * _Nullable)error; +/// Designated initializer +/// @param logger RollbarLogger instance to use when reporting intercepted NSExceptions captured by this guard instance -(instancetype)initWithLogger:(nonnull RollbarLogger *)logger NS_DESIGNATED_INITIALIZER; +/// Unavailable initializer -(instancetype)init NS_UNAVAILABLE; diff --git a/RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h b/RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h index 5993318b..248b661a 100644 --- a/RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h +++ b/RollbarSwift/Sources/RollbarSwift/include/RollbarTryCatch.h @@ -33,18 +33,23 @@ NS_ASSUME_NONNULL_BEGIN +/// Swift-friendly try-catch-finally equivalent for handling NSExceptions within the try-block @interface RollbarTryCatch : NSObject -/** - Provides try catch functionality for swift by wrapping around Objective-C - */ - -+ (void)try:(__attribute__((noescape)) void(^ _Nullable)(void))try - catch:(__attribute__((noescape)) void(^ _Nullable)(NSException* exception))catch - finally:(__attribute__((noescape)) void(^ _Nullable)(void))finally; +/// Thows NSException using provided string as the exception message +/// @param tryBlock code block to try +/// @param catchBlock exception handling code block +/// @param finallyBlock finally-excuted code block ++ (void)try:(__attribute__((noescape)) void(^ _Nullable)(void))tryBlock + catch:(__attribute__((noescape)) void(^ _Nullable)(NSException* exception))catchBlock + finally:(__attribute__((noescape)) void(^ _Nullable)(void))finallyBlock; +/// Thows NSException using provided string as the exception message +/// @param string exception message + (void)throwString:(NSString*)string; +/// Throws NSException +/// @param exception specified NSException instance + (void)throwException:(NSException*)exception; @end diff --git a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift index c90d312e..4eb5fbec 100644 --- a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift +++ b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift @@ -50,6 +50,14 @@ final class RollbarSwiftTests: XCTestCase { let exceptionGuard = createGuard(); + do { + try exceptionGuard.execute { + safeCode(); + }; + } catch { + XCTFail("Should never get here! Completely safe code was tried!"); + } + do { try exceptionGuard.execute { produceObjCException(); From 0df5f62b36187b38b61a0a5ab9fcb9c49e8574ea Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Thu, 11 Mar 2021 10:12:17 -0800 Subject: [PATCH 07/11] added macosAppSwift demo app --- .../macosAppSwift.xcodeproj/project.pbxproj | 334 ++++++++++++++++++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 58 +++ .../Assets.xcassets/Contents.json | 6 + .../macosAppSwift/ContentView.swift | 21 ++ Demos/macosAppSwift/macosAppSwift/Info.plist | 24 ++ .../Preview Assets.xcassets/Contents.json | 6 + .../macosAppSwift/macosAppSwift.entitlements | 10 + .../macosAppSwift/macosAppSwiftApp.swift | 17 + .../contents.xcworkspacedata | 3 + 10 files changed, 490 insertions(+) create mode 100644 Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj create mode 100644 Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Demos/macosAppSwift/macosAppSwift/Assets.xcassets/Contents.json create mode 100644 Demos/macosAppSwift/macosAppSwift/ContentView.swift create mode 100644 Demos/macosAppSwift/macosAppSwift/Info.plist create mode 100644 Demos/macosAppSwift/macosAppSwift/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements create mode 100644 Demos/macosAppSwift/macosAppSwift/macosAppSwiftApp.swift diff --git a/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj new file mode 100644 index 00000000..11281547 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj @@ -0,0 +1,334 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 55098C6525FA930D0045C180 /* macosAppSwiftApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55098C6425FA930D0045C180 /* macosAppSwiftApp.swift */; }; + 55098C6725FA930D0045C180 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55098C6625FA930D0045C180 /* ContentView.swift */; }; + 55098C6925FA93110045C180 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55098C6825FA93110045C180 /* Assets.xcassets */; }; + 55098C6C25FA93110045C180 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55098C6B25FA93110045C180 /* Preview Assets.xcassets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 55098C6125FA930D0045C180 /* macosAppSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = macosAppSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 55098C6425FA930D0045C180 /* macosAppSwiftApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = macosAppSwiftApp.swift; sourceTree = ""; }; + 55098C6625FA930D0045C180 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 55098C6825FA93110045C180 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 55098C6B25FA93110045C180 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 55098C6D25FA93110045C180 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 55098C6E25FA93110045C180 /* macosAppSwift.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macosAppSwift.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 55098C5E25FA930D0045C180 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 55098C5825FA930D0045C180 = { + isa = PBXGroup; + children = ( + 55098C6325FA930D0045C180 /* macosAppSwift */, + 55098C6225FA930D0045C180 /* Products */, + ); + sourceTree = ""; + }; + 55098C6225FA930D0045C180 /* Products */ = { + isa = PBXGroup; + children = ( + 55098C6125FA930D0045C180 /* macosAppSwift.app */, + ); + name = Products; + sourceTree = ""; + }; + 55098C6325FA930D0045C180 /* macosAppSwift */ = { + isa = PBXGroup; + children = ( + 55098C6425FA930D0045C180 /* macosAppSwiftApp.swift */, + 55098C6625FA930D0045C180 /* ContentView.swift */, + 55098C6825FA93110045C180 /* Assets.xcassets */, + 55098C6D25FA93110045C180 /* Info.plist */, + 55098C6E25FA93110045C180 /* macosAppSwift.entitlements */, + 55098C6A25FA93110045C180 /* Preview Content */, + ); + path = macosAppSwift; + sourceTree = ""; + }; + 55098C6A25FA93110045C180 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 55098C6B25FA93110045C180 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 55098C6025FA930D0045C180 /* macosAppSwift */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55098C7125FA93110045C180 /* Build configuration list for PBXNativeTarget "macosAppSwift" */; + buildPhases = ( + 55098C5D25FA930D0045C180 /* Sources */, + 55098C5E25FA930D0045C180 /* Frameworks */, + 55098C5F25FA930D0045C180 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = macosAppSwift; + productName = macosAppSwift; + productReference = 55098C6125FA930D0045C180 /* macosAppSwift.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 55098C5925FA930D0045C180 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1240; + LastUpgradeCheck = 1240; + TargetAttributes = { + 55098C6025FA930D0045C180 = { + CreatedOnToolsVersion = 12.4; + }; + }; + }; + buildConfigurationList = 55098C5C25FA930D0045C180 /* Build configuration list for PBXProject "macosAppSwift" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 55098C5825FA930D0045C180; + productRefGroup = 55098C6225FA930D0045C180 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 55098C6025FA930D0045C180 /* macosAppSwift */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 55098C5F25FA930D0045C180 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55098C6C25FA93110045C180 /* Preview Assets.xcassets in Resources */, + 55098C6925FA93110045C180 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 55098C5D25FA930D0045C180 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55098C6725FA930D0045C180 /* ContentView.swift in Sources */, + 55098C6525FA930D0045C180 /* macosAppSwiftApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 55098C6F25FA93110045C180 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 11.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 55098C7025FA93110045C180 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 11.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 55098C7225FA93110045C180 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macosAppSwift/macosAppSwift.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_ASSET_PATHS = "\"macosAppSwift/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = macosAppSwift/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 11.0; + PRODUCT_BUNDLE_IDENTIFIER = com.rollbar.macosAppSwift; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 55098C7325FA93110045C180 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macosAppSwift/macosAppSwift.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_ASSET_PATHS = "\"macosAppSwift/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = macosAppSwift/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 11.0; + PRODUCT_BUNDLE_IDENTIFIER = com.rollbar.macosAppSwift; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 55098C5C25FA930D0045C180 /* Build configuration list for PBXProject "macosAppSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55098C6F25FA93110045C180 /* Debug */, + 55098C7025FA93110045C180 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55098C7125FA93110045C180 /* Build configuration list for PBXNativeTarget "macosAppSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55098C7225FA93110045C180 /* Debug */, + 55098C7325FA93110045C180 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 55098C5925FA930D0045C180 /* Project object */; +} diff --git a/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AccentColor.colorset/Contents.json b/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AppIcon.appiconset/Contents.json b/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..3f00db43 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/Contents.json b/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demos/macosAppSwift/macosAppSwift/ContentView.swift b/Demos/macosAppSwift/macosAppSwift/ContentView.swift new file mode 100644 index 00000000..83a9d3bf --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/ContentView.swift @@ -0,0 +1,21 @@ +// +// ContentView.swift +// macosAppSwift +// +// Created by Andrey Kornich on 2021-03-11. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + Text("Hello, world!") + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/Demos/macosAppSwift/macosAppSwift/Info.plist b/Demos/macosAppSwift/macosAppSwift/Info.plist new file mode 100644 index 00000000..69c84ae7 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + + diff --git a/Demos/macosAppSwift/macosAppSwift/Preview Content/Preview Assets.xcassets/Contents.json b/Demos/macosAppSwift/macosAppSwift/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements b/Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Demos/macosAppSwift/macosAppSwift/macosAppSwiftApp.swift b/Demos/macosAppSwift/macosAppSwift/macosAppSwiftApp.swift new file mode 100644 index 00000000..e4fa59d3 --- /dev/null +++ b/Demos/macosAppSwift/macosAppSwift/macosAppSwiftApp.swift @@ -0,0 +1,17 @@ +// +// macosAppSwiftApp.swift +// macosAppSwift +// +// Created by Andrey Kornich on 2021-03-11. +// + +import SwiftUI + +@main +struct macosAppSwiftApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/RollbarSDK.xcworkspace/contents.xcworkspacedata b/RollbarSDK.xcworkspace/contents.xcworkspacedata index aa9d279a..7bbc2d69 100644 --- a/RollbarSDK.xcworkspace/contents.xcworkspacedata +++ b/RollbarSDK.xcworkspace/contents.xcworkspacedata @@ -84,6 +84,9 @@ + + From 7a9d1b58f934ec8cf4e0ab828e362d18767aa978 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Fri, 12 Mar 2021 00:30:47 -0800 Subject: [PATCH 08/11] first cut: macosAppSwift demo app --- .../macosAppSwift.xcodeproj/project.pbxproj | 36 +++++++- .../macosAppSwift/ContentView.swift | 84 ++++++++++++++++++- .../macosAppSwift/macosAppSwift.entitlements | 12 ++- .../RollbarSwift/RollbarExceptionGuard.m | 9 +- 4 files changed, 128 insertions(+), 13 deletions(-) diff --git a/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj index 11281547..c03f8180 100644 --- a/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj +++ b/Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -11,6 +11,9 @@ 55098C6725FA930D0045C180 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55098C6625FA930D0045C180 /* ContentView.swift */; }; 55098C6925FA93110045C180 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55098C6825FA93110045C180 /* Assets.xcassets */; }; 55098C6C25FA93110045C180 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55098C6B25FA93110045C180 /* Preview Assets.xcassets */; }; + 5544A01F25FB074300C710A1 /* RollbarCommon in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A01E25FB074300C710A1 /* RollbarCommon */; }; + 5544A02125FB074300C710A1 /* RollbarNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02025FB074300C710A1 /* RollbarNotifier */; }; + 5544A02325FB074300C710A1 /* RollbarSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02225FB074300C710A1 /* RollbarSwift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -28,6 +31,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 5544A01F25FB074300C710A1 /* RollbarCommon in Frameworks */, + 5544A02125FB074300C710A1 /* RollbarNotifier in Frameworks */, + 5544A02325FB074300C710A1 /* RollbarSwift in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -39,6 +45,7 @@ children = ( 55098C6325FA930D0045C180 /* macosAppSwift */, 55098C6225FA930D0045C180 /* Products */, + 5544A01D25FB074300C710A1 /* Frameworks */, ); sourceTree = ""; }; @@ -71,6 +78,13 @@ path = "Preview Content"; sourceTree = ""; }; + 5544A01D25FB074300C710A1 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -87,6 +101,11 @@ dependencies = ( ); name = macosAppSwift; + packageProductDependencies = ( + 5544A01E25FB074300C710A1 /* RollbarCommon */, + 5544A02025FB074300C710A1 /* RollbarNotifier */, + 5544A02225FB074300C710A1 /* RollbarSwift */, + ); productName = macosAppSwift; productReference = 55098C6125FA930D0045C180 /* macosAppSwift.app */; productType = "com.apple.product-type.application"; @@ -329,6 +348,21 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 5544A01E25FB074300C710A1 /* RollbarCommon */ = { + isa = XCSwiftPackageProductDependency; + productName = RollbarCommon; + }; + 5544A02025FB074300C710A1 /* RollbarNotifier */ = { + isa = XCSwiftPackageProductDependency; + productName = RollbarNotifier; + }; + 5544A02225FB074300C710A1 /* RollbarSwift */ = { + isa = XCSwiftPackageProductDependency; + productName = RollbarSwift; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 55098C5925FA930D0045C180 /* Project object */; } diff --git a/Demos/macosAppSwift/macosAppSwift/ContentView.swift b/Demos/macosAppSwift/macosAppSwift/ContentView.swift index 83a9d3bf..40845046 100644 --- a/Demos/macosAppSwift/macosAppSwift/ContentView.swift +++ b/Demos/macosAppSwift/macosAppSwift/ContentView.swift @@ -6,11 +6,84 @@ // import SwiftUI +import RollbarSwift struct ContentView: View { + var body: some View { - Text("Hello, world!") - .padding() + VStack(content: { + Text("Hello, world!") + .multilineTextAlignment(.center) + .padding() + Button("Handle Swift Error") { + self.handleSwiftError() + } + Button("Handle Obj-C Exception") { + self.handleObjCException() + } + Button("Handle Obj-C Exception with Rollbar") { + self.handleObjCExceptionWithRollbar() + } + }) + } + +func handleSwiftError() { + do { + try self.generateSwiftError(); + } + catch AppError.problem1 { + + } + catch AppError.problem2 { + + } + catch { + print("Unexpected error: \(error).") + } + } + + func generateSwiftError() throws { + throw AppError.limitExceeded(limit: 5) + } + + func handleObjCException() { + do { + self.generateObjCException(); + } + catch { + print("Unexpected error: \(error).") + } + } + + func generateObjCException() { + RollbarTryCatch.throw("NSException from Obj-C...") + } + + func handleObjCExceptionWithRollbar() { + + let exceptionGuard = createGuard(); + + var success = true; + + success = exceptionGuard.tryExecute { + self.generateObjCException(); + } + + print("Guearded execution succeeded: \(success).") + } + + func createGuard() -> RollbarExceptionGuard { + + let config = RollbarConfig(); + config.destination.accessToken = "2ffc7997ed864dda94f63e7b7daae0f3"; + config.destination.environment = "samples"; + config.developerOptions.transmit = true; + + let logger = RollbarLogger(configuration: config); + + let exceptionGuard = RollbarExceptionGuard(logger: logger); + + return exceptionGuard; } } @@ -19,3 +92,10 @@ struct ContentView_Previews: PreviewProvider { ContentView() } } + +// Declare our error type +enum AppError: Error { + case problem1 + case problem2 + case limitExceeded(limit: Int) +} diff --git a/Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements b/Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements index f2ef3ae0..40b639e4 100644 --- a/Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements +++ b/Demos/macosAppSwift/macosAppSwift/macosAppSwift.entitlements @@ -2,9 +2,13 @@ - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + com.apple.security.network.client + + com.apple.security.network.server + diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m index d093345c..2df45477 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m @@ -35,12 +35,9 @@ -(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))tryBlock if (nil != self->logger) { - NSDictionary *customData = @{ - [NSString stringWithFormat:@"%@_%@", RollbarExceptionGuard.className, @"NSError"]: exceptionError, - }; [self->logger log:RollbarLevel_Critical exception:exception - data:customData + data:nil context:RollbarExceptionGuard.className ]; [self->logger log:RollbarLevel_Critical @@ -74,10 +71,10 @@ -(instancetype)initWithLogger:(nonnull RollbarLogger *)logger { - (NSError *)convertException:(nonnull NSException *)exception { - NSMutableDictionary *userInfo = + NSMutableDictionary *userInfo = //NULL [[NSMutableDictionary alloc] init]; - if (nil != exception.userInfo) { + if (nil != exception.userInfo && exception.userInfo.count > 0) { userInfo = [[NSMutableDictionary alloc] initWithDictionary:exception.userInfo]; From 7e21ea4476ba8f83c18a3763c6b1b313cd66fb9a Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Fri, 12 Mar 2021 17:22:49 -0800 Subject: [PATCH 09/11] RollbarSwift code clean-up --- .../macosAppSwift/ContentView.swift | 16 ++++++ .../RollbarSwift/RollbarExceptionGuard.m | 56 ++++++++++--------- .../Sources/RollbarSwift/RollbarTryCatch.m | 11 +++- .../RollbarSwiftTests.m | 4 +- .../RollbarSwiftTests/RollbarSwiftTests.swift | 10 ++++ .../RollbarSwiftTests/XCTestManifests.swift | 3 + 6 files changed, 70 insertions(+), 30 deletions(-) diff --git a/Demos/macosAppSwift/macosAppSwift/ContentView.swift b/Demos/macosAppSwift/macosAppSwift/ContentView.swift index 40845046..107c79e6 100644 --- a/Demos/macosAppSwift/macosAppSwift/ContentView.swift +++ b/Demos/macosAppSwift/macosAppSwift/ContentView.swift @@ -11,16 +11,21 @@ import RollbarSwift struct ContentView: View { var body: some View { + VStack(content: { + Text("Hello, world!") .multilineTextAlignment(.center) .padding() + Button("Handle Swift Error") { self.handleSwiftError() } + Button("Handle Obj-C Exception") { self.handleObjCException() } + Button("Handle Obj-C Exception with Rollbar") { self.handleObjCExceptionWithRollbar() } @@ -28,7 +33,9 @@ struct ContentView: View { } func handleSwiftError() { + do { + try self.generateSwiftError(); } catch AppError.problem1 { @@ -38,24 +45,30 @@ func handleSwiftError() { } catch { + print("Unexpected error: \(error).") } } func generateSwiftError() throws { + throw AppError.limitExceeded(limit: 5) } func handleObjCException() { + do { + self.generateObjCException(); } catch { + print("Unexpected error: \(error).") } } func generateObjCException() { + RollbarTryCatch.throw("NSException from Obj-C...") } @@ -66,6 +79,7 @@ func handleSwiftError() { var success = true; success = exceptionGuard.tryExecute { + self.generateObjCException(); } @@ -88,7 +102,9 @@ func handleSwiftError() { } struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() } } diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m index 2df45477..66dcabb2 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m @@ -24,32 +24,35 @@ -(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))tryBlock __block BOOL success = NO; __block NSError* exceptionError = nil; - [RollbarTryCatch try:^(void){ - - tryBlock(); - success = YES; - } - catch:^(NSException *exception){ - - exceptionError = [self convertException:exception]; - - if (nil != self->logger) { + [RollbarTryCatch try:^(void) { + + tryBlock(); + success = YES; + } + catch:^(NSException *exception) { + + exceptionError = [self convertException:exception]; + + if (nil != self->logger) { + + [self->logger log:RollbarLevel_Critical + exception:exception + data:nil + context:RollbarExceptionGuard.className + ]; + + [self->logger log:RollbarLevel_Critical + error:exceptionError + data:nil + context:RollbarExceptionGuard.className + ]; + } + + success = NO; + } + finally:^{ - [self->logger log:RollbarLevel_Critical - exception:exception - data:nil - context:RollbarExceptionGuard.className - ]; - [self->logger log:RollbarLevel_Critical - error:exceptionError - data:nil - context:RollbarExceptionGuard.className - ]; } - - success = NO; - } - finally:^{} ]; *error = exceptionError; @@ -71,10 +74,9 @@ -(instancetype)initWithLogger:(nonnull RollbarLogger *)logger { - (NSError *)convertException:(nonnull NSException *)exception { - NSMutableDictionary *userInfo = //NULL - [[NSMutableDictionary alloc] init]; + NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init]; - if (nil != exception.userInfo && exception.userInfo.count > 0) { + if ((nil != exception.userInfo) && (0 < exception.userInfo.count)) { userInfo = [[NSMutableDictionary alloc] initWithDictionary:exception.userInfo]; diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m b/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m index dd340626..8df4a76c 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarTryCatch.m @@ -40,15 +40,23 @@ + (void)try:(__attribute__((noescape)) void(^ _Nullable)(void))tryBlock finally:(__attribute__((noescape)) void(^ _Nullable)(void))finallyBlock { @try { - if (NULL != tryBlock) tryBlock(); + + if (NULL != tryBlock) { + + tryBlock(); + } } @catch (NSException *exception) { + if (NULL != catchBlock) { + catchBlock(exception); } } @finally { + if (NULL != finallyBlock) { + finallyBlock(); } } @@ -63,6 +71,7 @@ + (void)throwString:(NSString*)string { } + (void)throwException:(NSException*)exception { + @throw exception; } diff --git a/RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m b/RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m index 4cdf040b..1ebb2a19 100644 --- a/RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m +++ b/RollbarSwift/Tests/RollbarSwiftTests-ObjC/RollbarSwiftTests.m @@ -9,8 +9,8 @@ @interface RollbarSwiftTests : XCTestCase @implementation RollbarSwiftTests -- (void)testBasics { -} +//- (void)testBasics { +//} @end diff --git a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift index 4eb5fbec..9027d1c1 100644 --- a/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift +++ b/RollbarSwift/Tests/RollbarSwiftTests/RollbarSwiftTests.swift @@ -34,13 +34,17 @@ final class RollbarSwiftTests: XCTestCase { var success = true; success = exceptionGuard.tryExecute { + safeCode(); } + XCTAssertTrue(success); success = exceptionGuard.tryExecute { + produceObjCException(); } + XCTAssertTrue(!success); Thread.sleep(forTimeInterval: 2); @@ -51,18 +55,24 @@ final class RollbarSwiftTests: XCTestCase { let exceptionGuard = createGuard(); do { + try exceptionGuard.execute { + safeCode(); }; } catch { + XCTFail("Should never get here! Completely safe code was tried!"); } do { + try exceptionGuard.execute { + produceObjCException(); }; } catch { + NSLog(error.localizedDescription); XCTAssertTrue(error.localizedDescription.contains("Fake NSException")); } diff --git a/RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift b/RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift index 9cb1daf7..0bcce54c 100644 --- a/RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift +++ b/RollbarSwift/Tests/RollbarSwiftTests/XCTestManifests.swift @@ -1,9 +1,12 @@ import XCTest #if !canImport(ObjectiveC) + public func allTests() -> [XCTestCaseEntry] { + return [ testCase(RollbarSwiftTests.allTests), ] } + #endif From e9db4e658281b274630b96291c14036adb8ba436 Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Fri, 12 Mar 2021 17:27:27 -0800 Subject: [PATCH 10/11] incremented version --- RollbarCommon.podspec | 2 +- RollbarDeploys.podspec | 2 +- RollbarKSCrash.podspec | 2 +- RollbarNotifier.podspec | 2 +- RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m | 2 +- RollbarPLCrashReporter.podspec | 2 +- RollbarSDK.experimental_podspec | 2 +- RollbarSwift.podspec | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/RollbarCommon.podspec b/RollbarCommon.podspec index f4fbcf9a..9e9f1317 100644 --- a/RollbarCommon.podspec +++ b/RollbarCommon.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.0-beta2" + s.version = "2.0.0-beta3" s.name = "RollbarCommon" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarDeploys.podspec b/RollbarDeploys.podspec index 0e06671d..1b716f40 100644 --- a/RollbarDeploys.podspec +++ b/RollbarDeploys.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.0-beta2" + s.version = "2.0.0-beta3" s.name = "RollbarDeploys" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarKSCrash.podspec b/RollbarKSCrash.podspec index c040fc21..22e0242a 100644 --- a/RollbarKSCrash.podspec +++ b/RollbarKSCrash.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.0-beta2" + s.version = "2.0.0-beta3" s.name = "RollbarKSCrash" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarNotifier.podspec b/RollbarNotifier.podspec index d52b2644..add9883e 100644 --- a/RollbarNotifier.podspec +++ b/RollbarNotifier.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.0-beta2" + s.version = "2.0.0-beta3" s.name = "RollbarNotifier" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m b/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m index e5cb9d17..c6ffa5b6 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m +++ b/RollbarNotifier/Sources/RollbarNotifier/DTOs/RollbarConfig.m @@ -22,7 +22,7 @@ #pragma mark - constants -static NSString * const NOTIFIER_VERSION = @"2.0.0-beta2"; +static NSString * const NOTIFIER_VERSION = @"2.0.0-beta3"; static NSString * const NOTIFIER_NAME = @"rollbar-apple"; diff --git a/RollbarPLCrashReporter.podspec b/RollbarPLCrashReporter.podspec index 2de70c78..ccf775d3 100644 --- a/RollbarPLCrashReporter.podspec +++ b/RollbarPLCrashReporter.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.0-beta2" + s.version = "2.0.0-beta3" s.name = "RollbarPLCrashReporter" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC diff --git a/RollbarSDK.experimental_podspec b/RollbarSDK.experimental_podspec index c9cb6ecf..5781e1a5 100644 --- a/RollbarSDK.experimental_podspec +++ b/RollbarSDK.experimental_podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |sdk| # Rollbar SDK: # ============ - sdk.version = "2.0.0-beta2" + sdk.version = "2.0.0-beta3" sdk.name = "RollbarSDK" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." sdk.description = <<-DESC diff --git a/RollbarSwift.podspec b/RollbarSwift.podspec index 0d69289f..0c040238 100644 --- a/RollbarSwift.podspec +++ b/RollbarSwift.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| - s.version = "2.0.0-beta2" + s.version = "2.0.0-beta3" s.name = "RollbarSwift" s.summary = "Application or client side SDK for interacting with the Rollbar API Server." s.description = <<-DESC From e9736c95f29efb77b8ce1f5ead8e4fad091cbb1c Mon Sep 17 00:00:00 2001 From: Andrey Kornich Date: Tue, 16 Mar 2021 11:50:39 -0700 Subject: [PATCH 11/11] RollbarSwift: addressing PR comments --- .../macosAppSwift/ContentView.swift | 2 +- .../RollbarSwift/RollbarExceptionGuard.m | 55 ++++++++++--------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Demos/macosAppSwift/macosAppSwift/ContentView.swift b/Demos/macosAppSwift/macosAppSwift/ContentView.swift index 107c79e6..e5dddf33 100644 --- a/Demos/macosAppSwift/macosAppSwift/ContentView.swift +++ b/Demos/macosAppSwift/macosAppSwift/ContentView.swift @@ -83,7 +83,7 @@ func handleSwiftError() { self.generateObjCException(); } - print("Guearded execution succeeded: \(success).") + print("Guarded execution succeeded: \(success).") } func createGuard() -> RollbarExceptionGuard { diff --git a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m index 66dcabb2..7eb7f344 100644 --- a/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m +++ b/RollbarSwift/Sources/RollbarSwift/RollbarExceptionGuard.m @@ -8,51 +8,52 @@ #import "RollbarExceptionGuard.h" #import "RollbarTryCatch.h" -@implementation RollbarExceptionGuard { +@implementation RollbarExceptionGuard { @private RollbarLogger *logger; } -(BOOL)tryExecute:(nonnull void(NS_NOESCAPE^)(void))block { + NSError *error = nil; return [self execute:block error:&error]; } -(BOOL)execute:(nonnull void(NS_NOESCAPE^)(void))tryBlock - error:(__autoreleasing NSError * _Nullable * _Nullable)error { + error:(__autoreleasing NSError * _Nullable * _Nullable)error { __block BOOL success = NO; __block NSError* exceptionError = nil; [RollbarTryCatch try:^(void) { + + tryBlock(); + success = YES; + } + catch:^(NSException *exception) { + + exceptionError = [self convertException:exception]; + + if (nil != self->logger) { - tryBlock(); - success = YES; - } - catch:^(NSException *exception) { - - exceptionError = [self convertException:exception]; - - if (nil != self->logger) { - - [self->logger log:RollbarLevel_Critical - exception:exception - data:nil - context:RollbarExceptionGuard.className - ]; - - [self->logger log:RollbarLevel_Critical - error:exceptionError - data:nil - context:RollbarExceptionGuard.className - ]; - } - - success = NO; - } - finally:^{ + [self->logger log:RollbarLevel_Critical + exception:exception + data:nil + context:RollbarExceptionGuard.className + ]; + [self->logger log:RollbarLevel_Critical + error:exceptionError + data:nil + context:RollbarExceptionGuard.className + ]; } + + success = NO; + } + finally:^{ + + } ]; *error = exceptionError;