Skip to content

Commit c878461

Browse files
authored
Merge pull request #85 from backtrace-labs/release
Release branch for 1.7.4
2 parents 98f74d5 + 2c2eb68 commit c878461

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1962
-1480
lines changed

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

Backtrace.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Pod::Spec.new do |s|
2525
s.osx.source_files = ["Sources/**/*.{swift}", "Backtrace-macOS/**/*.{h*,swift}"]
2626
s.tvos.source_files = ["Sources/**/*.{swift}", "Backtrace-tvOS/**/*.{h*,swift}"]
2727

28-
s.osx.exclude_files = ["Sources/Features/Breadcrumb/**/*.{swift}"]
2928
s.tvos.exclude_files = ["Sources/Features/Breadcrumb/**/*.{swift}"]
3029

3130
s.ios.public_header_files = ["Backtrace-iOS/**/*.h*"]
3231
s.osx.public_header_files = ["Backtrace-macOS/**/*.h*"]
3332
s.tvos.public_header_files = ["Backtrace-tvOS/**/*.h*"]
3433

35-
s.ios.dependency "Cassette", "1.0.0-beta5"
34+
s.ios.dependency "Cassette", '1.0.0-beta5'
35+
s.osx.dependency "Cassette", '1.0.0-beta5'
3636
s.dependency "Backtrace-PLCrashReporter", '1.5.3'
3737

3838
s.resources = 'Sources/**/*.xcdatamodeld'

Backtrace.xcodeproj/project.pbxproj

Lines changed: 349 additions & 353 deletions
Large diffs are not rendered by default.

Examples/Common/Keys.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ NS_ASSUME_NONNULL_BEGIN
44

55
@interface Keys : NSObject
66

7-
/// [Submission URL](https://help.backtrace.io/en/articles/1772855-what-is-a-submission-url)
7+
@property(class, nonatomic, assign, readonly) NSString *universeName;
8+
9+
/// [Submission URL](https://support.backtrace.io/hc/en-us/articles/360040516451-What-is-a-submission-url-)
810
@property(class, nonatomic, assign, readonly) NSString *backtraceUrl;
911
@property(class, nonatomic, assign, readonly) NSString *backtraceSubmissionUrl;
1012

11-
/// [Submission token](https://help.backtrace.io/en/articles/1772818-what-is-a-submission-token)
13+
/// [Submission token](https://support.backtrace.io/hc/en-us/articles/360040105172)
1214
@property(class, nonatomic, assign, readonly) NSString *backtraceToken;
1315

1416
@end

Examples/Common/Keys.m

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@
22

33
@implementation Keys
44

5+
+ (NSString const *) universeName {
6+
// Set your universe name here - https://support.backtrace.io/hc/en-us/articles/360040516451-What-is-a-submission-url-
7+
// e.g.: yourteam
8+
return @"yourteam";
9+
}
10+
511
+ (NSString const *) backtraceUrl {
6-
// Set your submission URL - https://help.backtrace.io/en/articles/1772855-what-is-a-submission-url
12+
// Set your submission URL - https://support.backtrace.io/hc/en-us/articles/360040516451-What-is-a-submission-url-
713
// e.g.: https://yourteam.backtrace.io
8-
return @"https://yourteam.backtrace.io";
14+
return [NSString stringWithFormat: @"https://%@.sp.backtrace.io:6098", [Keys universeName]];
915
}
1016

1117
+ (NSString const *) backtraceToken {
12-
// Set your submission token - https://help.backtrace.io/en/articles/1772818-what-is-a-submission-token
18+
// Set your submission token - https://support.backtrace.io/hc/en-us/articles/360040105172
1319
return @"token";
1420
}
1521

1622
+ (NSString const *) backtraceSubmissionUrl {
17-
// Set your submission URL - https://help.backtrace.io/en/articles/1772855-what-is-a-submission-url
23+
// Set your submission URL - https://support.backtrace.io/hc/en-us/articles/360040516451-What-is-a-submission-url-
1824
// e.g.: https://submit.backtrace.io/{universe}/{token}/plcrash
19-
return @"https://submit.backtrace.io/{universe}/{token}/plcrash";
25+
return [NSString stringWithFormat: @"https://submit.backtrace.io/%@/%@/plcrash", [Keys universeName], [Keys backtraceToken]];
2026
}
2127

2228
@end

Examples/Example-iOS-ObjC/AppDelegate.m

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,47 @@ @interface AppDelegate () <BacktraceClientDelegate>
1010
@implementation AppDelegate
1111

1212
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
13+
NSArray *paths = @[[[NSBundle mainBundle] pathForResource: @"test" ofType: @"txt"]];
14+
NSString *fileName = @"myCustomFile.txt";
15+
NSURL *libraryUrl = [[[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory
16+
inDomains:NSUserDomainMask] lastObject];
17+
NSURL *fileUrl = [libraryUrl URLByAppendingPathComponent:fileName];
18+
1319
BacktraceCredentials *credentials = [[BacktraceCredentials alloc]
1420
initWithEndpoint: [NSURL URLWithString: Keys.backtraceUrl]
1521
token: [Keys backtraceToken]];
1622
BacktraceDatabaseSettings *backtraceDatabaseSettings = [[BacktraceDatabaseSettings alloc] init];
17-
backtraceDatabaseSettings.maxRecordCount = 1000;
18-
backtraceDatabaseSettings.maxDatabaseSize = 10;
19-
backtraceDatabaseSettings.retryInterval = 5;
20-
backtraceDatabaseSettings.retryLimit = 3;
21-
backtraceDatabaseSettings.retryBehaviour = RetryBehaviourInterval;
22-
backtraceDatabaseSettings.retryOrder = RetryOrderStack;
23-
23+
backtraceDatabaseSettings.maxRecordCount = 10;
24+
2425
BacktraceClientConfiguration *configuration = [[BacktraceClientConfiguration alloc]
2526
initWithCredentials: credentials
2627
dbSettings: backtraceDatabaseSettings
2728
reportsPerMin: 3
2829
allowsAttachingDebugger: TRUE
29-
detectOOM: FALSE];
30-
[configuration enableBreadCrumbs:@[@(BacktraceBreadcrumbTypeManual), @(BacktraceBreadcrumbTypeLog)]];
30+
detectOOM: TRUE];
3131
BacktraceClient.shared = [[BacktraceClient alloc] initWithConfiguration: configuration error: nil];
32-
BacktraceClient.shared.delegate = self;
32+
BacktraceClient.shared.attributes = @{@"foo": @"bar", @"testing": @YES};
33+
BacktraceClient.shared.attachments = [NSArray arrayWithObjects:fileUrl, nil];
3334

3435
// sending NSException
3536
@try {
3637
NSArray *array = @[];
37-
NSObject *object = array[1]; // will throw exception
38+
array[1]; // will throw exception
3839
} @catch (NSException *exception) {
39-
NSArray *paths = @[[[NSBundle mainBundle] pathForResource: @"test" ofType: @"txt"]];
40-
[[BacktraceClient shared] sendWithAttachmentPaths: paths completion: ^(BacktraceResult * _Nonnull result) {
40+
[[BacktraceClient shared] sendWithAttachmentPaths: [NSArray init] completion: ^(BacktraceResult * _Nonnull result) {
4141
NSLog(@"%@", result);
4242
}];
4343
} @finally {
4444

4545
}
4646

4747
//sending NSError
48-
NSError *error = [NSError errorWithDomain: @"backtrace.domain" code: 100 userInfo: @{}];
49-
NSArray *paths = @[[[NSBundle mainBundle] pathForResource: @"test" ofType: @"txt"]];
5048
[[BacktraceClient shared] sendWithAttachmentPaths: paths completion: ^(BacktraceResult * _Nonnull result) {
5149
NSLog(@"%@", result);
5250
}];
5351

54-
55-
52+
BacktraceClient.shared.delegate = self;
53+
[BacktraceClient.shared enableBreadcrumbs];
5654
NSDictionary *attributes = @{@"My Attribute":@"My Attribute Value"};
5755
[[BacktraceClient shared] addBreadcrumb:@"My Native Breadcrumb"
5856
attributes:attributes

Examples/Example-iOS-ObjC/Base.lproj/Main.storyboard

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3-
<device id="retina4_7" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
64
<dependencies>
75
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
97
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
108
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
119
</dependencies>
@@ -19,26 +17,36 @@
1917
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2018
<subviews>
2119
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fhp-D4-2oC">
22-
<rect key="frame" x="10" y="30" width="355" height="507"/>
20+
<rect key="frame" x="10" y="10" width="355" height="527"/>
2321
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2422
<fontDescription key="fontDescription" type="system" pointSize="14"/>
2523
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
2624
</textView>
2725
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="tQm-Xk-agy">
2826
<rect key="frame" x="10" y="547" width="355" height="110"/>
2927
<subviews>
30-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wfh-no-STH">
31-
<rect key="frame" x="0.0" y="0.0" width="355" height="50"/>
28+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wfh-no-STH">
29+
<rect key="frame" x="0.0" y="0.0" width="355" height="30"/>
30+
<color key="backgroundColor" red="0.86495327950000001" green="0.49887192250000001" blue="0.45880818369999998" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
31+
<state key="normal" title="out of memory report">
32+
<color key="titleColor" red="0.23527315260000001" green="0.23534822459999999" blue="0.2313722074" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
33+
</state>
34+
<connections>
35+
<action selector="outOfMemoryReportAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="j1d-Yg-4mQ"/>
36+
</connections>
37+
</button>
38+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5SP-Go-i82">
39+
<rect key="frame" x="0.0" y="40" width="355" height="30"/>
3240
<color key="backgroundColor" red="0.86495327950000001" green="0.49887192250000001" blue="0.45880818369999998" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
3341
<state key="normal" title="live report">
3442
<color key="titleColor" red="0.23527315260000001" green="0.23534822459999999" blue="0.2313722074" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
3543
</state>
3644
<connections>
37-
<action selector="liveReportAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="r8l-mx-oQk"/>
45+
<action selector="liveReportAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Bqu-q0-7Zw"/>
3846
</connections>
3947
</button>
40-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4g4-3C-4oZ">
41-
<rect key="frame" x="0.0" y="60" width="355" height="50"/>
48+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4g4-3C-4oZ">
49+
<rect key="frame" x="0.0" y="80" width="355" height="30"/>
4250
<color key="backgroundColor" red="0.86495327950000001" green="0.49887192250000001" blue="0.45880818369999998" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
4351
<state key="normal" title="crash">
4452
<color key="titleColor" red="0.23527315260000001" green="0.23534822459999999" blue="0.2313722074" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
@@ -53,6 +61,7 @@
5361
</constraints>
5462
</stackView>
5563
</subviews>
64+
<viewLayoutGuide key="safeArea" id="Wq8-QM-bIQ"/>
5665
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
5766
<constraints>
5867
<constraint firstItem="Wq8-QM-bIQ" firstAttribute="bottom" secondItem="tQm-Xk-agy" secondAttribute="bottom" constant="10" id="6Uy-hB-fYL"/>
@@ -63,14 +72,14 @@
6372
<constraint firstItem="tQm-Xk-agy" firstAttribute="leading" secondItem="Wq8-QM-bIQ" secondAttribute="leading" constant="10" id="eY6-cL-M6I"/>
6473
<constraint firstItem="Fhp-D4-2oC" firstAttribute="top" secondItem="Wq8-QM-bIQ" secondAttribute="top" constant="10" id="vbK-EV-v8z"/>
6574
</constraints>
66-
<viewLayoutGuide key="safeArea" id="Wq8-QM-bIQ"/>
6775
</view>
6876
<connections>
6977
<outlet property="textView" destination="Fhp-D4-2oC" id="NVZ-d1-QD6"/>
7078
</connections>
7179
</viewController>
7280
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
7381
</objects>
82+
<point key="canvasLocation" x="49" y="53"/>
7483
</scene>
7584
</scenes>
7685
</document>

Examples/Example-iOS-ObjC/ViewController.m

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,22 @@ @interface ViewController ()
88

99
@implementation ViewController
1010

11+
static NSMutableData *wastedMemory = nil;
12+
1113
- (void)viewDidLoad {
1214
[super viewDidLoad];
13-
15+
wastedMemory = [[NSMutableData alloc] init];
16+
}
17+
18+
- (IBAction) outOfMemoryReportAction: (id) sender {
19+
// The trick is: to aggressively take up memory but not allocate a block too large to cause a crash
20+
// This is obviously device dependent, so the 500k may have to be tweaked
21+
int size = 500000;
22+
for (int i = 0; i < 10000 ; i++) {
23+
[wastedMemory appendData:[NSMutableData dataWithLength:size]];
24+
}
1425
}
26+
1527
- (IBAction) liveReportAction: (id) sender {
1628
NSArray *paths = @[@"/home/test.txt"];
1729
[[BacktraceClient shared] sendWithAttachmentPaths:paths completion:^(BacktraceResult * _Nonnull result) {
@@ -21,7 +33,7 @@ - (IBAction) liveReportAction: (id) sender {
2133

2234
- (IBAction) crashAction: (id) sender {
2335
NSArray *array = @[];
24-
NSObject *o = array[1];
36+
array[1];
2537
}
2638

2739

0 commit comments

Comments
 (0)