Skip to content

Commit

Permalink
Merge pull request #979 from bugsnag/release-v6.6.0
Browse files Browse the repository at this point in the history
Release v6.6.0
  • Loading branch information
nickdowell authored Jan 20, 2021
2 parents f993036 + 4da4f66 commit b834068
Show file tree
Hide file tree
Showing 23 changed files with 200 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ steps:
limit: 2

- label: 'Update documentation page'
if: build.tag =~ /^v[2-9]\.[0-9]+\.[0-9]+\$/ && build.branch == "master"
if: build.branch == "master"
agents:
queue: opensource-mac-cocoa
concurrency: 3
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bugsnag",
"version": "6.5.1",
"version": "6.6.0",
"summary": "The Bugsnag crash reporting framework for Apple platforms.",
"homepage": "https://bugsnag.com",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa.git",
"tag": "v6.5.1"
"tag": "v6.6.0"
},
"frameworks": [
"Foundation",
Expand Down
16 changes: 8 additions & 8 deletions Bugsnag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
008967122486D43700DC48C2 /* BugsnagEventTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B32486D43500DC48C2 /* BugsnagEventTests.m */; };
008967132486D43700DC48C2 /* BugsnagEventTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B32486D43500DC48C2 /* BugsnagEventTests.m */; };
008967142486D43700DC48C2 /* BugsnagEventTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B32486D43500DC48C2 /* BugsnagEventTests.m */; };
008967152486D43700DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B42486D43500DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m */; };
008967162486D43700DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B42486D43500DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m */; };
008967172486D43700DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B42486D43500DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m */; };
008967152486D43700DC48C2 /* BugsnagCollectionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B42486D43500DC48C2 /* BugsnagCollectionsTests.m */; };
008967162486D43700DC48C2 /* BugsnagCollectionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B42486D43500DC48C2 /* BugsnagCollectionsTests.m */; };
008967172486D43700DC48C2 /* BugsnagCollectionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B42486D43500DC48C2 /* BugsnagCollectionsTests.m */; };
008967182486D43700DC48C2 /* BugsnagErrorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B52486D43500DC48C2 /* BugsnagErrorTest.m */; };
008967192486D43700DC48C2 /* BugsnagErrorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B52486D43500DC48C2 /* BugsnagErrorTest.m */; };
0089671A2486D43700DC48C2 /* BugsnagErrorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 008966B52486D43500DC48C2 /* BugsnagErrorTest.m */; };
Expand Down Expand Up @@ -1056,7 +1056,7 @@
008966B02486D43500DC48C2 /* BugsnagSwiftPublicAPITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BugsnagSwiftPublicAPITests.swift; sourceTree = "<group>"; };
008966B12486D43500DC48C2 /* BugsnagSwiftConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BugsnagSwiftConfigurationTests.swift; sourceTree = "<group>"; };
008966B32486D43500DC48C2 /* BugsnagEventTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagEventTests.m; sourceTree = "<group>"; };
008966B42486D43500DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagCollectionsBSGDictMergeTest.m; sourceTree = "<group>"; };
008966B42486D43500DC48C2 /* BugsnagCollectionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagCollectionsTests.m; sourceTree = "<group>"; };
008966B52486D43500DC48C2 /* BugsnagErrorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagErrorTest.m; sourceTree = "<group>"; };
008966B62486D43500DC48C2 /* BugsnagSessionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BugsnagSessionTest.m; sourceTree = "<group>"; };
008966B72486D43500DC48C2 /* report.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = report.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1669,7 +1669,7 @@
008966CA2486D43600DC48C2 /* BugsnagClientMirrorTest.m */,
008966A52486D43400DC48C2 /* BugsnagClientPayloadInfoTest.m */,
008966BE2486D43500DC48C2 /* BugsnagClientTests.m */,
008966B42486D43500DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m */,
008966B42486D43500DC48C2 /* BugsnagCollectionsTests.m */,
00896A432486DBF000DC48C2 /* BugsnagConfigurationTests.m */,
008966A42486D43400DC48C2 /* BugsnagDeviceTest.m */,
008966CB2486D43600DC48C2 /* BugsnagEnabledBreadcrumbTest.m */,
Expand Down Expand Up @@ -2619,7 +2619,7 @@
008967332486D43700DC48C2 /* BugsnagClientTests.m in Sources */,
004E353F2487B3BD007FBAE4 /* BugsnagSwiftConfigurationTests.swift in Sources */,
008967542486D43700DC48C2 /* BugsnagOnCrashTest.m in Sources */,
008967152486D43700DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m in Sources */,
008967152486D43700DC48C2 /* BugsnagCollectionsTests.m in Sources */,
01E8765E256684E700F4B70A /* URLSessionMock.m in Sources */,
008967AB2486D43700DC48C2 /* KSMach_Tests.m in Sources */,
0089672A2486D43700DC48C2 /* BugsnagStacktraceTest.m in Sources */,
Expand Down Expand Up @@ -2754,7 +2754,7 @@
004E353D2487B3B8007FBAE4 /* BugsnagSwiftTests.swift in Sources */,
008967192486D43700DC48C2 /* BugsnagErrorTest.m in Sources */,
016875C7258D003200DFFF69 /* NSUserDefaultsStub.m in Sources */,
008967162486D43700DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m in Sources */,
008967162486D43700DC48C2 /* BugsnagCollectionsTests.m in Sources */,
008967582486D43700DC48C2 /* BugsnagClientMirrorTest.m in Sources */,
0089676A2486D43700DC48C2 /* BugsnagSessionTrackerTest.m in Sources */,
008967792486D43700DC48C2 /* KSMachHeader_Tests.m in Sources */,
Expand Down Expand Up @@ -2913,7 +2913,7 @@
008967472486D43700DC48C2 /* BugsnagTests.m in Sources */,
008967A72486D43700DC48C2 /* KSString_Tests.m in Sources */,
0089671A2486D43700DC48C2 /* BugsnagErrorTest.m in Sources */,
008967172486D43700DC48C2 /* BugsnagCollectionsBSGDictMergeTest.m in Sources */,
008967172486D43700DC48C2 /* BugsnagCollectionsTests.m in Sources */,
008967532486D43700DC48C2 /* BSGOutOfMemoryTests.m in Sources */,
008967592486D43700DC48C2 /* BugsnagClientMirrorTest.m in Sources */,
0089676B2486D43700DC48C2 /* BugsnagSessionTrackerTest.m in Sources */,
Expand Down
6 changes: 6 additions & 0 deletions Bugsnag/Bugsnag+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ NS_ASSUME_NONNULL_BEGIN

#pragma mark Methods

+ (void)addRuntimeVersionInfo:(NSString *)info withKey:(NSString *)key; // Used in BugsnagReactNative

+ (void)notifyInternal:(BugsnagEvent *)event block:(BOOL (^)(BugsnagEvent *))block; // Used in BugsnagReactNative

+ (void)purge;

+ (void)removeOnBreadcrumbBlock:(BugsnagOnBreadcrumbBlock)block;

+ (void)updateCodeBundleId:(NSString *)codeBundleId; // Used in BugsnagReactNative

@end

NS_ASSUME_NONNULL_END
1 change: 1 addition & 0 deletions Bugsnag/BugsnagCrashSentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>

#import "BSG_KSCrashReportWriter.h"
#import "BSG_KSCrashType.h"
#import "BugsnagConfiguration.h"
#import "BugsnagErrorReportApiClient.h"

Expand Down
1 change: 0 additions & 1 deletion Bugsnag/BugsnagSystemState.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#define SYSTEMSTATE_APP_WAS_TERMINATED @"wasTerminated"
#define SYSTEMSTATE_APP_IS_ACTIVE @"isActive"
#define SYSTEMSTATE_APP_IS_IN_FOREGROUND @"inForeground"
#define SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING @"lowMemory"
#define SYSTEMSTATE_APP_VERSION @"version"
#define SYSTEMSTATE_APP_BUNDLE_VERSION @"bundleVersion"
#define SYSTEMSTATE_APP_DEBUGGER_IS_ACTIVE @"debuggerIsActive"
Expand Down
9 changes: 0 additions & 9 deletions Bugsnag/BugsnagSystemState.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
NSMutableDictionary *app = state[SYSTEMSTATE_KEY_APP];

// KV-store versions of these are authoritative
app[SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING] = [kvstore stringForKey:SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING defaultValue:@""];
app[SYSTEMSTATE_APP_WAS_TERMINATED] = [kvstore NSBooleanForKey:SYSTEMSTATE_APP_WAS_TERMINATED defaultValue:false];
app[SYSTEMSTATE_APP_IS_ACTIVE] = [kvstore NSBooleanForKey:SYSTEMSTATE_APP_IS_ACTIVE defaultValue:false];
app[SYSTEMSTATE_APP_IS_IN_FOREGROUND] = [kvstore NSBooleanForKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND defaultValue:false];
Expand Down Expand Up @@ -84,7 +83,6 @@ id blankIfNil(id value) {
isActive = appState == UIApplicationStateActive;
#endif

[kvstore deleteKey:SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING];
[kvstore deleteKey:SYSTEMSTATE_APP_WAS_TERMINATED];
[kvstore setBoolean:isActive forKey:SYSTEMSTATE_APP_IS_ACTIVE];
[kvstore setBoolean:isInForeground forKey:SYSTEMSTATE_APP_IS_IN_FOREGROUND];
Expand All @@ -110,7 +108,6 @@ id blankIfNil(id value) {
NSMutableDictionary *device = [NSMutableDictionary new];
device[SYSTEMSTATE_DEVICE_BOOT_TIME] = [BSG_RFC3339DateTool stringFromDate:systemInfo[@BSG_KSSystemField_BootTime]];
device[@"id"] = systemInfo[@BSG_KSSystemField_DeviceAppHash];
// device[@"lowMemory"] is initially unset
device[@"osBuild"] = systemInfo[@BSG_KSSystemField_OSVersion];
device[@"osVersion"] = systemInfo[@BSG_KSSystemField_SystemVersion];
device[@"osName"] = systemInfo[@BSG_KSSystemField_SystemName];
Expand Down Expand Up @@ -210,12 +207,6 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)config {
[strongSelf.kvStore setBoolean:NO forKey:SYSTEMSTATE_APP_IS_ACTIVE];
[strongSelf setValue:@NO forAppKey:SYSTEMSTATE_APP_IS_ACTIVE];
}];
[center addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
__strong __typeof__(self) strongSelf = weakSelf;
NSString *date = [BSG_RFC3339DateTool stringFromDate:[NSDate date]];
[strongSelf.kvStore setString:date forKey:SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING];
[strongSelf setValue:date forAppKey:SYSTEMSTATE_APP_LAST_LOW_MEMORY_WARNING];
}];
#endif
[center addObserver:self selector:@selector(sessionUpdateNotification:) name:BSGSessionUpdateNotification object:nil];
}
Expand Down
6 changes: 6 additions & 0 deletions Bugsnag/Client/BugsnagClient+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import <Bugsnag/BugsnagClient.h>

#import "BugsnagMetadata+Private.h" // For BugsnagObserverBlock

@class BugsnagBreadcrumbs;
@class BugsnagConfiguration;
@class BugsnagCrashSentry;
Expand Down Expand Up @@ -76,6 +78,8 @@ NS_ASSUME_NONNULL_BEGIN

- (void)addBreadcrumbWithBlock:(void (^)(BugsnagBreadcrumb *))block;

- (void)addObserverWithBlock:(BugsnagObserverBlock)block; // Used in BugsnagReactNative

- (void)addRuntimeVersionInfo:(NSString *)info withKey:(NSString *)key;

- (NSDictionary *)collectAppWithState; // Used in BugsnagReactNative
Expand All @@ -88,6 +92,8 @@ NS_ASSUME_NONNULL_BEGIN

- (void)notifyInternal:(BugsnagEvent *)event block:(BugsnagOnErrorBlock)block;

- (void)removeObserverWithBlock:(BugsnagObserverBlock)block; // Used in BugsnagReactNative

- (BOOL)shouldReportOOM;

- (void)start;
Expand Down
16 changes: 9 additions & 7 deletions Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -741,20 +741,22 @@ - (BOOL)appendNSErrorInfo:(NSError *)error
block:(BugsnagOnErrorBlock)block
event:(BugsnagEvent *)event {
event.originalError = error;
[event addMetadata:@{
@"code" : @(error.code),
@"domain" : error.domain,
BSGKeyReason : error.localizedFailureReason ?: @""
}
toSection:@"nserror"];

NSMutableDictionary *metadata = [NSMutableDictionary dictionary];
metadata[@"code"] = @(error.code);
metadata[@"domain"] = error.domain;
metadata[BSGKeyReason] = error.localizedFailureReason;
metadata[@"userInfo"] = BSGJSONDictionary(error.userInfo);
[event addMetadata:metadata toSection:@"nserror"];

if (event.context == nil) { // set context as error domain
event.context = [NSString stringWithFormat:@"%@ (%ld)", error.domain, (long)error.code];
}

if (block) {
return block(event);
}
return true;
return YES;
}

- (void)notify:(NSException *_Nonnull)exception {
Expand Down
5 changes: 5 additions & 0 deletions Bugsnag/Helpers/BugsnagCollections.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@
* @param destination a dictionary or nil
*/
NSDictionary *BSGDictMerge(NSDictionary *source, NSDictionary *destination);

/// Returns a representation of the dictionary that contains only valid JSON.
/// Any dictionary keys that are not strings will be ignored.
/// Any values that are not valid JSON will be replaced by a string description.
NSDictionary * BSGJSONDictionary(NSDictionary *dictionary);
26 changes: 26 additions & 0 deletions Bugsnag/Helpers/BugsnagCollections.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#import "BugsnagCollections.h"

#import "BSGJSONSerialization.h"

NSDictionary *BSGDictMerge(NSDictionary *source, NSDictionary *destination) {
if ([destination count] == 0) {
return source;
Expand All @@ -41,3 +43,27 @@
}
return dict;
}

NSDictionary * BSGJSONDictionary(NSDictionary *dictionary) {
if (!dictionary) {
return nil;
}
if ([BSGJSONSerialization isValidJSONObject:dictionary]) {
return dictionary;
}
NSMutableDictionary *json = [NSMutableDictionary dictionary];
for (id key in dictionary) {
if (![key isKindOfClass:[NSString class]]) {
continue;
}
const id value = dictionary[key];
if ([BSGJSONSerialization isValidJSONObject:@{key: value}]) {
json[key] = value;
} else if ([value isKindOfClass:[NSDictionary class]]) {
json[key] = BSGJSONDictionary(value);
} else {
json[key] = ((NSObject *)value).description;
}
}
return json;
}
2 changes: 2 additions & 0 deletions Bugsnag/Payload/BugsnagEvent+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ NS_ASSUME_NONNULL_BEGIN

- (instancetype)initWithUserData:(NSDictionary *)event;

- (void)attachCustomStacktrace:(NSArray *)frames withType:(NSString *)type; // Used in BugsnagReactNative

/// Whether this report should be sent, based on release stage information cached at crash time and within the application currently.
- (BOOL)shouldBeSent;

Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagNotifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (instancetype)init {
#else
self.name = @"Bugsnag Objective-C";
#endif
self.version = @"6.5.1";
self.version = @"6.6.0";
self.url = @"https://github.com/bugsnag/bugsnag-cocoa";
self.dependencies = [NSMutableArray new];
}
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
Changelog
=========

## 6.6.0 (2021-01-20)

### Enhancements

* The NSError's `userInfo` property is now included in reports.
[#974](https://github.com/bugsnag/bugsnag-cocoa/pull/974)

## 6.5.1 (2021-01-13)

### Bug fixes

* Fix a regression where OOM events were missing session information.
[#963](https://github.com/bugsnag/bugsnag-cocoa/pull/963)

* Make `maxPersistedEvents` and `maxPersistedSessions` comply with the specification, with defaults of 32 and 128 respectively.
[#966](https://github.com/bugsnag/bugsnag-cocoa/pull/966)

Expand Down
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.5.1</string>
<string>6.6.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,14 @@ doc: ## Generate html documentation
@mv docs/masterTOC.html docs/index.html

update-docs: ## Update and upload docs to Github
ifeq ($(BUILDKITE),)
ifneq ($(BUILDKITE_BRANCH), master)
@$(error Docs deployment is handled by CI, and shouldn't be run locally)
endif
ifeq ($(BUILDKITE_TAG),)
@$(error Docs deployments should only occur on a tagged release)
endif
@git clone --single-branch --branch=gh-pages git@github.com:bugsnag/bugsnag-cocoa.git docs
@make doc
@cd docs
@git add .
@git commit -m "Docs update for $BUILDKITE_TAG release"
@git commit -m "Docs update for $(PRESET_VERSION) release"
@git push --force-with-lease

help: ## Show help text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// BugsnagCollectionsBSGDictMergeTest.m
// BugsnagCollectionsTests.m
// Tests
//
// Created by Paul Zabelin on 7/1/19.
Expand All @@ -9,10 +9,15 @@
@import XCTest;
#import "BugsnagCollections.h"

@interface BugsnagCollectionsBSGDictMergeTest : XCTestCase
@interface BugsnagCollectionsTests : XCTestCase
@end

@implementation BugsnagCollectionsBSGDictMergeTest
@interface BugsnagCollectionsTests_DummyObject : NSObject
@end

@implementation BugsnagCollectionsTests

// MARK: BSGDictMergeTest

- (void)testBasicMerge {
NSDictionary *combined = @{@"a": @"one",
Expand Down Expand Up @@ -58,4 +63,43 @@ - (void)testSrcDstDict {
XCTAssertEqualObjects(expected, BSGDictMerge(src, dst), @"should combine");
}

// MARK: BSGJSONDictionary

- (void)testBSGJSONDictionary {
XCTAssertNil(BSGJSONDictionary(nil));

id validDictionary = @{
@"name": @"foobar",
@"count": @1,
@"userInfo": @{@"extra": @"hello"}
};
XCTAssertEqualObjects(BSGJSONDictionary(validDictionary), validDictionary);

id invalidDictionary = @{
@123: @"invalid key; should be ignored",
@[]: @"this is backwards",
@{}: @""
};
XCTAssertEqualObjects(BSGJSONDictionary(invalidDictionary), @{});

id mixedDictionary = @{
@"count": @42,
@"dict": @{@"object": [[BugsnagCollectionsTests_DummyObject alloc] init]},
@123: @"invalid key; should be ignored"
};
XCTAssertEqualObjects(BSGJSONDictionary(mixedDictionary),
(@{@"count": @42,
@"dict": @{@"object": @"Dummy object"}}));
}

@end

// MARK: -

@implementation BugsnagCollectionsTests_DummyObject

- (NSString *)description {
return @"Dummy object";
}

@end
Loading

0 comments on commit b834068

Please sign in to comment.