From f9c8b80dbc99dd77689534609b5ca83d7ed6143e Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 09:29:16 +0000 Subject: [PATCH 01/14] Assert that freeMemory < totalMemory in E2E scenarios --- features/app_and_device_attributes.feature | 1 + features/barebone_tests.feature | 2 ++ features/steps/ios_steps.rb | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/features/app_and_device_attributes.feature b/features/app_and_device_attributes.feature index 9f886a23a..c91d9a75e 100644 --- a/features/app_and_device_attributes.feature +++ b/features/app_and_device_attributes.feature @@ -35,6 +35,7 @@ Feature: App and Device attributes present | ios | @not_null | | macos | @null | And the error payload field "events.0.device.time" is a date + And the event "device.freeMemory" is less than the event "device.totalMemory" # App diff --git a/features/barebone_tests.feature b/features/barebone_tests.feature index 0a1375666..d3d30441e 100644 --- a/features/barebone_tests.feature +++ b/features/barebone_tests.feature @@ -28,6 +28,7 @@ Feature: Barebone tests And the event "app.version" equals "12.3" And the event "breadcrumbs.0.name" equals "Running BareboneTestHandledScenario" And the event "breadcrumbs.1.name" equals "This is super " + And the event "device.freeMemory" is less than the event "device.totalMemory" And the event "device.id" is not null And the event "device.jailbroken" is false And the event "device.locale" is not null @@ -119,6 +120,7 @@ Feature: Barebone tests And the event "app.version" equals "12.3" And the event "breadcrumbs.0.name" equals "Bugsnag loaded" And the event "breadcrumbs.1.name" is null + And the event "device.freeMemory" is less than the event "device.totalMemory" And the event "device.id" is not null And the event "device.jailbroken" is false And the event "device.locale" is not null diff --git a/features/steps/ios_steps.rb b/features/steps/ios_steps.rb index 600024aa3..0a01050c1 100644 --- a/features/steps/ios_steps.rb +++ b/features/steps/ios_steps.rb @@ -169,6 +169,14 @@ def request_fields_are_equal(key, index_a, index_b) assert_true(lower <= value && value <= upper, "Expected a value between #{lower} and #{upper}, but received #{value}") end +Then('the event {string} is less than the event {string}') do |field1, field2| + value1 = Maze::Helper.read_key_path(Maze::Server.errors.current[:body], "events.0.#{field1}") + assert_not_nil(value1, 'Expected a value') + value2 = Maze::Helper.read_key_path(Maze::Server.errors.current[:body], "events.0.#{field2}") + assert_not_nil(value2, 'Expected a value') + assert_true(value1 < value2, "Expected value to be less than #{value2}, but received #{value1}") +end + Then('the event breadcrumbs contain {string} with type {string}') do |string, type| crumbs = Maze::Helper.read_key_path(find_request(0)[:body], 'events.0.breadcrumbs') assert_not_equal(0, crumbs.length, 'There are no breadcrumbs on this event') From c295f8b0c3543d9b1c75eb47da15f7770ea230c9 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 09:42:28 +0000 Subject: [PATCH 02/14] Rename deviceWithDictionary: to deviceWithKSCrashReport: --- Bugsnag/BugsnagSessionTracker.m | 2 +- Bugsnag/Client/BugsnagClient.m | 2 +- Bugsnag/Payload/BugsnagDevice+Private.h | 2 +- Bugsnag/Payload/BugsnagDevice.m | 2 +- Bugsnag/Payload/BugsnagDeviceWithState+Private.h | 2 +- Bugsnag/Payload/BugsnagDeviceWithState.m | 2 +- Bugsnag/Payload/BugsnagEvent.m | 2 +- Tests/BugsnagDeviceTest.m | 10 +++++----- Tests/BugsnagSessionTest.m | 2 +- Tests/BugsnagSessionTrackingPayloadTest.m | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Bugsnag/BugsnagSessionTracker.m b/Bugsnag/BugsnagSessionTracker.m index 6f69caa33..dc4dc6d80 100644 --- a/Bugsnag/BugsnagSessionTracker.m +++ b/Bugsnag/BugsnagSessionTracker.m @@ -123,7 +123,7 @@ - (void)startNewSessionWithAutoCaptureValue:(BOOL)isAutoCaptured { BugsnagApp *app = [BugsnagApp appWithDictionary:@{@"system": systemInfo} config:self.config codeBundleId:self.codeBundleId]; - BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:@{@"system": systemInfo}]; + BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:@{@"system": systemInfo}]; [device appendRuntimeInfo:self.extraRuntimeInfo]; BugsnagSession *newSession = [[BugsnagSession alloc] initWithId:[[NSUUID UUID] UUIDString] diff --git a/Bugsnag/Client/BugsnagClient.m b/Bugsnag/Client/BugsnagClient.m index ba78c190a..f38cbb124 100644 --- a/Bugsnag/Client/BugsnagClient.m +++ b/Bugsnag/Client/BugsnagClient.m @@ -1163,7 +1163,7 @@ - (BugsnagAppWithState *)generateAppWithState:(NSDictionary *)systemInfo { } - (BugsnagDeviceWithState *)generateDeviceWithState:(NSDictionary *)systemInfo { - BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:@{@"system": systemInfo}]; + BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:@{@"system": systemInfo}]; device.time = [NSDate date]; // default to current time for handled errors [device appendRuntimeInfo:self.extraRuntimeInfo]; device.orientation = _lastOrientation; diff --git a/Bugsnag/Payload/BugsnagDevice+Private.h b/Bugsnag/Payload/BugsnagDevice+Private.h index 95b892673..dafd27da8 100644 --- a/Bugsnag/Payload/BugsnagDevice+Private.h +++ b/Bugsnag/Payload/BugsnagDevice+Private.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @interface BugsnagDevice () -+ (instancetype)deviceWithDictionary:(NSDictionary *)event; ++ (instancetype)deviceWithKSCrashReport:(NSDictionary *)event; + (instancetype)deserializeFromJson:(NSDictionary *)json; diff --git a/Bugsnag/Payload/BugsnagDevice.m b/Bugsnag/Payload/BugsnagDevice.m index 8a99d1c73..d1c124299 100644 --- a/Bugsnag/Payload/BugsnagDevice.m +++ b/Bugsnag/Payload/BugsnagDevice.m @@ -29,7 +29,7 @@ + (BugsnagDevice *)deserializeFromJson:(NSDictionary *)json { return device; } -+ (BugsnagDevice *)deviceWithDictionary:(NSDictionary *)event { ++ (BugsnagDevice *)deviceWithKSCrashReport:(NSDictionary *)event { BugsnagDevice *device = [BugsnagDevice new]; [self populateFields:device dictionary:event]; return device; diff --git a/Bugsnag/Payload/BugsnagDeviceWithState+Private.h b/Bugsnag/Payload/BugsnagDeviceWithState+Private.h index 107234986..9ed790a2c 100644 --- a/Bugsnag/Payload/BugsnagDeviceWithState+Private.h +++ b/Bugsnag/Payload/BugsnagDeviceWithState+Private.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN + (instancetype)deviceFromJson:(NSDictionary *)json; -+ (instancetype)deviceWithDictionary:(NSDictionary *)event; ++ (instancetype)deviceWithKSCrashReport:(NSDictionary *)event; + (instancetype)deviceWithOomData:(NSDictionary *)data; diff --git a/Bugsnag/Payload/BugsnagDeviceWithState.m b/Bugsnag/Payload/BugsnagDeviceWithState.m index c9d94da0f..3f412bf29 100644 --- a/Bugsnag/Payload/BugsnagDeviceWithState.m +++ b/Bugsnag/Payload/BugsnagDeviceWithState.m @@ -97,7 +97,7 @@ + (BugsnagDeviceWithState *)deviceWithOomData:(NSDictionary *)data { return device; } -+ (BugsnagDeviceWithState *)deviceWithDictionary:(NSDictionary *)event { ++ (BugsnagDeviceWithState *)deviceWithKSCrashReport:(NSDictionary *)event { BugsnagDeviceWithState *device = [BugsnagDeviceWithState new]; [self populateFields:device dictionary:event]; device.orientation = [event valueForKeyPath:@"user.state.deviceState.orientation"]; diff --git a/Bugsnag/Payload/BugsnagEvent.m b/Bugsnag/Payload/BugsnagEvent.m index d907b6580..9d4a709d6 100644 --- a/Bugsnag/Payload/BugsnagEvent.m +++ b/Bugsnag/Payload/BugsnagEvent.m @@ -360,7 +360,7 @@ - (instancetype)initWithKSCrashData:(NSDictionary *)event { } } NSString *deviceAppHash = [event valueForKeyPath:@"system.device_app_hash"]; - BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:event]; + BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:event]; BugsnagUser *user = [self parseUser:event deviceAppHash:deviceAppHash deviceId:device.id]; BugsnagConfiguration *config = [[BugsnagConfiguration alloc] initWithDictionaryRepresentation:[event valueForKeyPath:@"user.config"]]; BugsnagAppWithState *app = [BugsnagAppWithState appWithDictionary:event config:config codeBundleId:self.codeBundleId]; diff --git a/Tests/BugsnagDeviceTest.m b/Tests/BugsnagDeviceTest.m index 3fff062f7..4d93e875b 100644 --- a/Tests/BugsnagDeviceTest.m +++ b/Tests/BugsnagDeviceTest.m @@ -49,7 +49,7 @@ - (void)setUp { } - (void)testDevice { - BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:self.data]; + BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:self.data]; // verify stateless fields XCTAssertTrue(device.jailbroken); @@ -69,7 +69,7 @@ - (void)testDevice { } - (void)testDeviceWithState { - BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:self.data]; + BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:self.data]; // verify stateless fields XCTAssertTrue(device.jailbroken); @@ -99,7 +99,7 @@ - (void)testDeviceWithState { } - (void)testDeviceToDict { - BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:self.data]; + BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:self.data]; device.locale = @"en-US"; NSDictionary *dict = [device toDictionary]; @@ -122,7 +122,7 @@ - (void)testDeviceToDict { } - (void)testDeviceWithStateToDict { - BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithDictionary:self.data]; + BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:self.data]; device.locale = @"en-US"; NSDictionary *dict = [device toDictionary]; @@ -185,7 +185,7 @@ - (void)testDeviceFreeSpaceShouldBeNilWhenFailsToRetrieveIt { } - (void)testDeviceRuntimeInfoAppended { - BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:self.data]; + BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:self.data]; XCTAssertEqual(2, [device.runtimeVersions count]); XCTAssertEqualObjects(@"14B25", device.runtimeVersions[@"osBuild"]); XCTAssertEqualObjects(@"10.0.0 (clang-1000.11.45.5)", device.runtimeVersions[@"clangVersion"]); diff --git a/Tests/BugsnagSessionTest.m b/Tests/BugsnagSessionTest.m index 87063c05f..0e73e213a 100644 --- a/Tests/BugsnagSessionTest.m +++ b/Tests/BugsnagSessionTest.m @@ -84,7 +84,7 @@ - (BugsnagDevice *)generateDevice { } } }; - BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:deviceData]; + BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:deviceData]; device.locale = @"en-US"; return device; } diff --git a/Tests/BugsnagSessionTrackingPayloadTest.m b/Tests/BugsnagSessionTrackingPayloadTest.m index 314f19464..334aeca67 100644 --- a/Tests/BugsnagSessionTrackingPayloadTest.m +++ b/Tests/BugsnagSessionTrackingPayloadTest.m @@ -99,7 +99,7 @@ - (BugsnagDevice *)generateDevice { } } }; - BugsnagDevice *device = [BugsnagDevice deviceWithDictionary:deviceData]; + BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:deviceData]; device.locale = @"en-US"; return device; } From e5bc93978c9e679afc1521590e2ba97428f1b0b3 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 09:57:53 +0000 Subject: [PATCH 03/14] Assert freeMemory < totalMemory in unit tests --- Tests/BugsnagDeviceTest.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Tests/BugsnagDeviceTest.m b/Tests/BugsnagDeviceTest.m index 4d93e875b..eec068209 100644 --- a/Tests/BugsnagDeviceTest.m +++ b/Tests/BugsnagDeviceTest.m @@ -7,10 +7,10 @@ // #import -#import "BugsnagConfiguration.h" -#import "BugsnagDeviceWithState+Private.h" + +#import "BSG_KSSystemInfo.h" #import "BugsnagDevice+Private.h" -#import "BugsnagTestConstants.h" +#import "BugsnagDeviceWithState+Private.h" @interface BugsnagDeviceTest : XCTestCase @property NSDictionary *data; @@ -98,6 +98,12 @@ - (void)testDeviceWithState { XCTAssertEqualObjects([formatter dateFromString:@"2014-12-02T01:56:13Z"], device.time); } +- (void)testDeviceWithRealSystemInfo { + NSDictionary *systemInfo = [BSG_KSSystemInfo systemInfo]; + BugsnagDeviceWithState *device = [BugsnagDeviceWithState deviceWithKSCrashReport:@{@"system": systemInfo}]; + XCTAssertLessThan(device.freeMemory.unsignedLongLongValue, device.totalMemory.unsignedLongLongValue); +} + - (void)testDeviceToDict { BugsnagDevice *device = [BugsnagDevice deviceWithKSCrashReport:self.data]; device.locale = @"en-US"; From 42ca75415200a64ad18127babaae5f69b2deb716 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 10:11:51 +0000 Subject: [PATCH 04/14] Include free memory in systemInfo --- .../KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m b/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m index 1b747e6b2..d9f401484 100644 --- a/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m +++ b/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m @@ -429,11 +429,11 @@ + (NSDictionary *)systemInfo { sysInfo[@BSG_KSSystemField_DeviceAppHash] = [self deviceAndAppHash]; sysInfo[@BSG_KSSystemField_BuildType] = [BSG_KSSystemInfo buildType]; - NSDictionary *memory = @{ - @BSG_KSSystemField_Size: [self int64Sysctl:@"hw.memsize"], - @BSG_KSCrashField_Usable: @(bsg_ksmachusableMemory()) + sysInfo[@(BSG_KSSystemField_Memory)] = @{ + @(BSG_KSCrashField_Free): @(bsg_ksmachfreeMemory()), + @(BSG_KSCrashField_Usable): @(bsg_ksmachusableMemory()), + @(BSG_KSSystemField_Size): [self int64Sysctl:@"hw.memsize"] }; - sysInfo[@BSG_KSSystemField_Memory] = memory; NSDictionary *statsInfo = [[BSG_KSCrash sharedInstance] captureAppStats]; sysInfo[@BSG_KSCrashField_AppStats] = statsInfo; From d1a3b4ef0bb2c3de0f2f0d58c32cd2ec3ae1e41c Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 10:15:20 +0000 Subject: [PATCH 05/14] Don't fall back to "usable" for "freeMemory" --- Bugsnag/Payload/BugsnagDeviceWithState.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bugsnag/Payload/BugsnagDeviceWithState.m b/Bugsnag/Payload/BugsnagDeviceWithState.m index 3f412bf29..8482697e6 100644 --- a/Bugsnag/Payload/BugsnagDeviceWithState.m +++ b/Bugsnag/Payload/BugsnagDeviceWithState.m @@ -101,7 +101,7 @@ + (BugsnagDeviceWithState *)deviceWithKSCrashReport:(NSDictionary *)event { BugsnagDeviceWithState *device = [BugsnagDeviceWithState new]; [self populateFields:device dictionary:event]; device.orientation = [event valueForKeyPath:@"user.state.deviceState.orientation"]; - device.freeMemory = [event valueForKeyPath:@"system.memory.free"] ?: [event valueForKeyPath:@"system.memory.usable"]; + device.freeMemory = [event valueForKeyPath:@"system.memory.free"]; device.freeDisk = BSGDeviceFreeSpace(NSCachesDirectory); NSString *val = [event valueForKeyPath:@"report.timestamp"]; From 0f70af1ccf5f3de023527b39f5b8947a1190aba3 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 11:13:08 +0000 Subject: [PATCH 06/14] Add #1021 to changelog [skip ci] --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ad88ba7f..a9ab1db97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +## TBD + +### Bug fixes + +* Fix incorrect `freeMemory` for errors reported via `notify()` + [#1021](https://github.com/bugsnag/bugsnag-cocoa/pull/1021) + ## 6.7.0 (2021-03-03) ### Enhancements From 96d2c32fec86ca99f08a4811ad438aa39471506d Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 15:00:15 +0000 Subject: [PATCH 07/14] Fix missing osName and osVersion if UIKit is not linked --- .../KSCrash/Recording/BSG_KSSystemInfo.m | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m b/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m index 1b747e6b2..8575bb05e 100644 --- a/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m +++ b/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m @@ -371,11 +371,19 @@ + (NSDictionary *)systemInfo { #ifdef __clang_version__ sysInfo[@BSG_KSSystemField_ClangVersion] = @__clang_version__; #endif -#if BSG_HAS_UIDEVICE - sysInfo[@BSG_KSSystemField_SystemName] = [UIDEVICE currentDevice].systemName; - sysInfo[@BSG_KSSystemField_SystemVersion] = [UIDEVICE currentDevice].systemVersion; -#else +#if TARGET_OS_IOS + // Note: This does not match UIDevice.currentDevice.systemName for versions + // prior to (and some versions of) iOS 9 where the systemName was reported + // as "iPhone OS". UIDevice gets its data from MobileGestalt which is a + // private API. /System/Library/CoreServices/SystemVersion.plist contains + // the information we need but will contain the macOS information when + // running on the Simulator. + sysInfo[@BSG_KSSystemField_SystemName] = @"iOS"; +#elif TARGET_OS_OSX sysInfo[@BSG_KSSystemField_SystemName] = @"Mac OS"; +#elif TARGET_OS_TV + sysInfo[@BSG_KSSystemField_SystemName] = @"tvOS"; +#endif NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion; NSString *systemVersion; @@ -389,7 +397,7 @@ + (NSDictionary *)systemInfo { version.minorVersion, version.patchVersion]; } sysInfo[@BSG_KSSystemField_SystemVersion] = systemVersion; -#endif + if ([self isSimulatorBuild]) { NSString *model = [NSProcessInfo processInfo] .environment[BSGKeySimulatorModelId]; From d3de334456a5ce82bd07959c5021a81e17060df5 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 16:57:06 +0000 Subject: [PATCH 08/14] Fix compiler warnings --- .../Source/KSCrash/Recording/BSG_KSSystemInfo.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m b/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m index 8575bb05e..0ad0090fa 100644 --- a/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m +++ b/Bugsnag/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m @@ -389,12 +389,13 @@ + (NSDictionary *)systemInfo { NSString *systemVersion; if (version.patchVersion == 0) { systemVersion = - [NSString stringWithFormat:@"%ld.%ld", version.majorVersion, - version.minorVersion]; + [NSString stringWithFormat:@"%ld.%ld", + (long)version.majorVersion, (long)version.minorVersion]; } else { - systemVersion = [NSString - stringWithFormat:@"%ld.%ld.%ld", version.majorVersion, - version.minorVersion, version.patchVersion]; + systemVersion = + [NSString stringWithFormat:@"%ld.%ld.%ld", + (long)version.majorVersion, (long)version.minorVersion, + (long)version.patchVersion]; } sysInfo[@BSG_KSSystemField_SystemVersion] = systemVersion; From d0c29a695a3c4bdcd64d589f75dc7439e83ba260 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 15:18:20 +0000 Subject: [PATCH 09/14] Prevent invalid batteryLevel and charging values being recorded when not linking UIKit --- Bugsnag/Client/BugsnagClient.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Bugsnag/Client/BugsnagClient.m b/Bugsnag/Client/BugsnagClient.m index ba78c190a..039225de1 100644 --- a/Bugsnag/Client/BugsnagClient.m +++ b/Bugsnag/Client/BugsnagClient.m @@ -1031,6 +1031,10 @@ - (void)metadataChanged:(BugsnagMetadata *)metadata { */ #if BSG_PLATFORM_IOS - (void)batteryChanged:(NSNotification *)notification { + if (![UIDEVICE currentDevice]) { + return; + } + NSNumber *batteryLevel = @([UIDEVICE currentDevice].batteryLevel); BOOL charging = [UIDEVICE currentDevice].batteryState == UIDeviceBatteryStateCharging || [UIDEVICE currentDevice].batteryState == UIDeviceBatteryStateFull; From b4e29798dfeed2c771eb4a299567a563140ab635 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 4 Mar 2021 15:21:46 +0000 Subject: [PATCH 10/14] Add #1022 to changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ad88ba7f..0bc13bcbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +## TBD + +### Bug fixes + +* Fix missing `osName` and `osVersion` for errors reported from app extensions that do not link against UIKit. + [#1022](https://github.com/bugsnag/bugsnag-cocoa/pull/1022) + ## 6.7.0 (2021-03-03) ### Enhancements From 2222e975aca57ba9d707d941720a57fd51406436 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Tue, 9 Mar 2021 11:41:03 +0000 Subject: [PATCH 11/14] Upload MacOS fixture test logs (#1015) --- .buildkite/pipeline.full.yml | 2 ++ .buildkite/pipeline.quick.yml | 1 + .buildkite/pipeline.yml | 1 + Gemfile.lock | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipeline.full.yml b/.buildkite/pipeline.full.yml index 11a03939a..11b6cd1b1 100644 --- a/.buildkite/pipeline.full.yml +++ b/.buildkite/pipeline.full.yml @@ -84,6 +84,7 @@ steps: plugins: artifacts#v1.3.0: download: ["features/fixtures/macos/output/macOSTestApp.zip"] + upload: ["macOSTestApp.log"] commands: - bundle install - bundle exec maze-runner @@ -103,6 +104,7 @@ steps: plugins: artifacts#v1.3.0: download: ["features/fixtures/macos/output/macOSTestApp.zip"] + upload: ["macOSTestApp.log"] commands: - bundle install - bundle exec maze-runner diff --git a/.buildkite/pipeline.quick.yml b/.buildkite/pipeline.quick.yml index 99d0b9ef3..2f3fd96b6 100644 --- a/.buildkite/pipeline.quick.yml +++ b/.buildkite/pipeline.quick.yml @@ -169,6 +169,7 @@ steps: plugins: artifacts#v1.3.0: download: ["features/fixtures/macos/output/macOSTestApp.zip"] + upload: ["macOSTestApp.log"] commands: - bundle install - bundle exec maze-runner diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index b4f68dac8..7484fee04 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -186,6 +186,7 @@ steps: plugins: artifacts#v1.3.0: download: ["features/fixtures/macos/output/macOSTestApp.zip"] + upload: ["macOSTestApp.log"] commands: - bundle install - bundle exec maze-runner diff --git a/Gemfile.lock b/Gemfile.lock index 7cdb88309..e15809786 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -160,7 +160,7 @@ GEM kramdown (~> 2.0) liferaft (0.0.6) mini_portile2 (2.5.0) - minitest (5.14.3) + minitest (5.14.4) molinillo (0.6.6) multi_json (1.15.0) multi_test (0.1.2) From 31144f3917092f8574e4523da636f497077fa1aa Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Tue, 9 Mar 2021 15:01:59 +0000 Subject: [PATCH 12/14] Enable Mac Catalyst for examples/objective-c-ios --- .../Bugsnag Test App.xcodeproj/project.pbxproj | 6 ++++++ .../Bugsnag Test App/Bugsnag Test App.entitlements | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 examples/objective-c-ios/Bugsnag Test App/Bugsnag Test App.entitlements diff --git a/examples/objective-c-ios/Bugsnag Test App.xcodeproj/project.pbxproj b/examples/objective-c-ios/Bugsnag Test App.xcodeproj/project.pbxproj index 2b1f36a9e..35f06d32e 100644 --- a/examples/objective-c-ios/Bugsnag Test App.xcodeproj/project.pbxproj +++ b/examples/objective-c-ios/Bugsnag Test App.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ /* Begin PBXFileReference section */ 0013DB142449E934003DB182 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 00C3ED5723F2D6D800757DBD /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 01CD18D525F7BA4700009EC3 /* Bugsnag Test App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Bugsnag Test App.entitlements"; sourceTree = ""; }; 89117F5055F6B6F9FA00FBEC /* Pods-Bugsnag Test App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Bugsnag Test App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Bugsnag Test App/Pods-Bugsnag Test App.debug.xcconfig"; sourceTree = ""; }; 8A4882E1224BCC130035B94C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 8A4882E3224BCD5D0035B94C /* OutOfMemoryController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OutOfMemoryController.h; sourceTree = ""; }; @@ -122,6 +123,7 @@ F40B875016AA233500676BB2 /* Bugsnag Test App */ = { isa = PBXGroup; children = ( + 01CD18D525F7BA4700009EC3 /* Bugsnag Test App.entitlements */, A1F5109A249A5C4000AFF4DE /* CxxException.h */, A1F51099249A5C4000AFF4DE /* CxxException.mm */, F40B875916AA233500676BB2 /* AppDelegate.h */, @@ -391,6 +393,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Bugsnag Test App/Bugsnag Test App.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; @@ -408,6 +411,7 @@ PROVISIONING_PROFILE = ""; SEPARATE_STRIP = YES; STRIP_INSTALLED_PRODUCT = YES; + SUPPORTS_MACCATALYST = YES; SWIFT_VERSION = 4.0; WRAPPER_EXTENSION = app; }; @@ -419,6 +423,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Bugsnag Test App/Bugsnag Test App.entitlements"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEPLOYMENT_POSTPROCESSING = YES; @@ -434,6 +439,7 @@ PROVISIONING_PROFILE = ""; SEPARATE_STRIP = YES; STRIP_INSTALLED_PRODUCT = YES; + SUPPORTS_MACCATALYST = YES; SWIFT_VERSION = 4.0; WRAPPER_EXTENSION = app; }; diff --git a/examples/objective-c-ios/Bugsnag Test App/Bugsnag Test App.entitlements b/examples/objective-c-ios/Bugsnag Test App/Bugsnag Test App.entitlements new file mode 100644 index 000000000..ee95ab7e5 --- /dev/null +++ b/examples/objective-c-ios/Bugsnag Test App/Bugsnag Test App.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + From c6d9a0ef48125b4745c710dcf6c08a9bc7e340db Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Tue, 9 Mar 2021 15:04:42 +0000 Subject: [PATCH 13/14] Fix os_proc_available_memory runtime link error on Mac Catalyst --- Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSMach.c | 4 ++-- CHANGELOG.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSMach.c b/Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSMach.c index fe4aff40e..d9c3903e9 100644 --- a/Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSMach.c +++ b/Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSMach.c @@ -38,7 +38,7 @@ #include #include -#if __has_include() && TARGET_OS_IPHONE +#if __has_include() && TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST #include #endif @@ -71,7 +71,7 @@ static pthread_t bsg_g_topThread; static size_t (* get_available_memory)(void); static void bsg_ksmachfreeMemory_init(void) { -#if __has_include() && TARGET_OS_IPHONE +#if __has_include() && TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST if (__builtin_available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { // Only use `os_proc_available_memory` if it appears to be working. // 0 is returned if the calling process is not an app or is running diff --git a/CHANGELOG.md b/CHANGELOG.md index 06d8c7190..7ac41441c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ Changelog ### Bug fixes +* Fix `os_proc_available_memory` runtime link error on Mac Catalyst. + [#1025](https://github.com/bugsnag/bugsnag-cocoa/pull/1025) + * Fix missing `osName` and `osVersion` for errors reported from app extensions that do not link against UIKit. [#1022](https://github.com/bugsnag/bugsnag-cocoa/pull/1022) From 99beda7d951ab8344839bfa769b5e69f60d5771b Mon Sep 17 00:00:00 2001 From: Karl Stenerud Date: Wed, 10 Mar 2021 12:09:40 +0100 Subject: [PATCH 14/14] Release v6.7.1 --- .jazzy.yaml | 4 ++-- Bugsnag.podspec.json | 4 ++-- Bugsnag/Payload/BugsnagNotifier.m | 2 +- CHANGELOG.md | 2 +- Framework/Info.plist | 2 +- Tests/Info.plist | 2 +- VERSION | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.jazzy.yaml b/.jazzy.yaml index 95a33ab88..170080bcb 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com" author: "Bugsnag Inc" clean: false # avoid deleting docs/.git framework_root: "Bugsnag" -github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.7.0/Bugsnag" +github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.7.1/Bugsnag" github_url: "https://github.com/bugsnag/bugsnag-cocoa" hide_documentation_coverage: true module: "Bugsnag" -module_version: "6.7.0" +module_version: "6.7.1" objc: true output: "docs" readme: "README.md" diff --git a/Bugsnag.podspec.json b/Bugsnag.podspec.json index e08bdab70..d0bff7d95 100644 --- a/Bugsnag.podspec.json +++ b/Bugsnag.podspec.json @@ -1,6 +1,6 @@ { "name": "Bugsnag", - "version": "6.7.0", + "version": "6.7.1", "summary": "The Bugsnag crash reporting framework for Apple platforms.", "homepage": "https://bugsnag.com", "license": "MIT", @@ -9,7 +9,7 @@ }, "source": { "git": "https://github.com/bugsnag/bugsnag-cocoa.git", - "tag": "v6.7.0" + "tag": "v6.7.1" }, "frameworks": [ "Foundation", diff --git a/Bugsnag/Payload/BugsnagNotifier.m b/Bugsnag/Payload/BugsnagNotifier.m index 48db4fd3f..d600ea3a2 100644 --- a/Bugsnag/Payload/BugsnagNotifier.m +++ b/Bugsnag/Payload/BugsnagNotifier.m @@ -23,7 +23,7 @@ - (instancetype)init { #else self.name = @"Bugsnag Objective-C"; #endif - self.version = @"6.7.0"; + self.version = @"6.7.1"; self.url = @"https://github.com/bugsnag/bugsnag-cocoa"; self.dependencies = [NSMutableArray new]; } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac41441c..62ca9f20f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog ========= -## TBD +## 6.7.1 (2021-03-10) ### Bug fixes diff --git a/Framework/Info.plist b/Framework/Info.plist index 427ffc62a..e6e276efb 100644 --- a/Framework/Info.plist +++ b/Framework/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 6.7.0 + 6.7.1 CFBundleVersion 1 diff --git a/Tests/Info.plist b/Tests/Info.plist index 4b7a27186..845465c3d 100644 --- a/Tests/Info.plist +++ b/Tests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 6.7.0 + 6.7.1 CFBundleVersion 1 diff --git a/VERSION b/VERSION index f0e13c509..06a765991 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.7.0 +6.7.1