forked from dbukowski/DBDebugToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # Example/DBDebugToolkit.xcodeproj/xcshareddata/xcschemes/DBDebugToolkit-Example.xcscheme # Example/Pods/Pods.xcodeproj/project.pbxproj # Example/Pods/Target Support Files/DBDebugToolkit/Info.plist
- Loading branch information
Showing
54 changed files
with
3,822 additions
and
1,613 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2017 Dariusz Bukowski | ||
// | ||
// 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. | ||
|
||
/** | ||
`UIView` category adding helper method for creating a snaphot image of the view. | ||
*/ | ||
@interface UIView (Snapshot) | ||
|
||
/** | ||
Creates and returns an image containing | ||
*/ | ||
- (UIImage *)snapshot; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2017 Dariusz Bukowski | ||
// | ||
// 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 "UIView+Snapshot.h" | ||
|
||
@implementation UIView (Snapshot) | ||
|
||
- (UIImage *)snapshot { | ||
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, [UIScreen mainScreen].scale); | ||
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:NO]; | ||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | ||
UIGraphicsEndImageContext(); | ||
return image; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2017 Dariusz Bukowski | ||
// | ||
// 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 <Foundation/Foundation.h> | ||
|
||
/** | ||
`DBCrashReport` is an object containing all the information about a collected crash. | ||
*/ | ||
@interface DBCrashReport : NSObject | ||
|
||
/** | ||
Initializes `DBCrashReport` object with the data contained in a dictionary. | ||
@param dictionary Dictionary containing all the information about a collected crash. | ||
*/ | ||
- (instancetype)initWithDictionary:(NSDictionary *)dictionary; | ||
|
||
/** | ||
Initializes `DBCrashReport` object with the provided data. | ||
@param name Name of the crash. | ||
@param reason Reason of the crash. | ||
@param userInfo User info attached to the crash. | ||
@param callStackSymbols An array of strings describing the call stack backtrace at the moment of the crash. | ||
@param date Date of the crash occurence. | ||
@param consoleOutput String containing the console output at the moment of the crash. | ||
@param screenshot The screenshot image taken at the moment of the crash. | ||
@param systemVersion Version of the system installed when the crash occured. | ||
@param appVersion Version of the application installed when the crash occured. | ||
*/ | ||
- (instancetype)initWithName:(NSString *)name | ||
reason:(NSString *)reason | ||
userInfo:(NSDictionary *)userInfo | ||
callStackSymbols:(NSArray<NSString *> *)callStackSymbols | ||
date:(NSDate *)date | ||
consoleOutput:(NSString *)consoleOutput | ||
screenshot:(UIImage *)screenshot | ||
systemVersion:(NSString *)systemVersion | ||
appVersion:(NSString *)appVersion; | ||
|
||
/** | ||
Returns a dictionary containing all the information about a collected crash. | ||
*/ | ||
- (NSDictionary *)dictionaryRepresentation; | ||
|
||
/** | ||
Returns a string containing the date of the crash occurence. | ||
*/ | ||
- (NSString *)dateString; | ||
|
||
/** | ||
Name of the crash. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSString *name; | ||
|
||
/** | ||
Reason of the crash. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSString *reason; | ||
|
||
/** | ||
User info attached to the crash. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSDictionary *userInfo; | ||
|
||
/** | ||
An array of strings describing the call stack backtrace at the moment of the crash. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSArray<NSString *> *callStackSymbols; | ||
|
||
/** | ||
Date of the crash occurence. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSDate *date; | ||
|
||
/** | ||
String containing the console output at the moment of the crash. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSString *consoleOutput; | ||
|
||
/** | ||
The screenshot image taken at the moment of the crash. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) UIImage *screenshot; | ||
|
||
/** | ||
Version of the system installed when the crash occured. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSString *systemVersion; | ||
|
||
/** | ||
Version of the application installed when the crash occured. Read-only. | ||
*/ | ||
@property (nonatomic, readonly) NSString *appVersion; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2017 Dariusz Bukowski | ||
// | ||
// 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 "DBCrashReport.h" | ||
|
||
static NSString *const DBCrashReportNameKey = @"name"; | ||
static NSString *const DBCrashReportReasonKey = @"reason"; | ||
static NSString *const DBCrashReportUserInfoKey = @"userInfo"; | ||
static NSString *const DBCrashReportCallStackSymbolsKey = @"callStackSymbols"; | ||
static NSString *const DBCrashReportDateKey = @"date"; | ||
static NSString *const DBCrashReportConsoleOutputKey = @"consoleOutput"; | ||
static NSString *const DBCrashReportScreenshotKey = @"screenshot"; | ||
static NSString *const DBCrashReportSystemVersionKey = @"systemVersion"; | ||
static NSString *const DBCrashReportAppVersionKey = @"appVersion"; | ||
|
||
@interface DBCrashReport () | ||
|
||
@property (nonatomic, copy) NSString *name; | ||
@property (nonatomic, copy) NSString *reason; | ||
@property (nonatomic, copy) NSDictionary *userInfo; | ||
@property (nonatomic, copy) NSArray<NSString *> *callStackSymbols; | ||
@property (nonatomic, strong) NSDate *date; | ||
@property (nonatomic, copy) NSString *consoleOutput; | ||
@property (nonatomic, strong) UIImage *screenshot; | ||
@property (nonatomic, copy) NSString *systemVersion; | ||
@property (nonatomic, copy) NSString *appVersion; | ||
|
||
@end | ||
|
||
@implementation DBCrashReport | ||
|
||
#pragma mark - Initialization | ||
|
||
- (instancetype)initWithDictionary:(NSDictionary *)dictionary { | ||
self = [super init]; | ||
if (self) { | ||
self.name = dictionary[DBCrashReportNameKey]; | ||
self.reason = dictionary[DBCrashReportReasonKey]; | ||
self.userInfo = dictionary[DBCrashReportUserInfoKey]; | ||
self.callStackSymbols = dictionary[DBCrashReportCallStackSymbolsKey]; | ||
self.date = dictionary[DBCrashReportDateKey]; | ||
self.consoleOutput = dictionary[DBCrashReportConsoleOutputKey]; | ||
NSData *screenshotData = [[NSData alloc] initWithBase64EncodedString:dictionary[DBCrashReportScreenshotKey] | ||
options:NSDataBase64DecodingIgnoreUnknownCharacters]; | ||
self.screenshot = [UIImage imageWithData:screenshotData]; | ||
self.systemVersion = dictionary[DBCrashReportSystemVersionKey]; | ||
self.appVersion = dictionary[DBCrashReportAppVersionKey]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (instancetype)initWithName:(NSString *)name | ||
reason:(NSString *)reason | ||
userInfo:(NSDictionary *)userInfo | ||
callStackSymbols:(NSArray<NSString *> *)callStackSymbols | ||
date:(NSDate *)date | ||
consoleOutput:(NSString *)consoleOutput | ||
screenshot:(UIImage *)screenshot | ||
systemVersion:(NSString *)systemVersion | ||
appVersion:(NSString *)appVersion { | ||
self = [super init]; | ||
if (self) { | ||
self.name = name; | ||
self.reason = reason; | ||
self.userInfo = userInfo; | ||
self.callStackSymbols = callStackSymbols; | ||
self.date = date; | ||
self.consoleOutput = consoleOutput; | ||
self.screenshot = screenshot; | ||
self.systemVersion = systemVersion; | ||
self.appVersion = appVersion; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
#pragma mark - Dictionary representation | ||
|
||
- (NSDictionary *)dictionaryRepresentation { | ||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; | ||
if (self.name) { | ||
dictionary[DBCrashReportNameKey] = self.name; | ||
} | ||
if (self.reason) { | ||
dictionary[DBCrashReportReasonKey] = self.reason; | ||
} | ||
if (self.userInfo) { | ||
dictionary[DBCrashReportUserInfoKey] = self.userInfo; | ||
} | ||
if (self.callStackSymbols) { | ||
dictionary[DBCrashReportCallStackSymbolsKey] = self.callStackSymbols; | ||
} | ||
if (self.date) { | ||
dictionary[DBCrashReportDateKey] = self.date; | ||
} | ||
if (self.consoleOutput) { | ||
dictionary[DBCrashReportConsoleOutputKey] = self.consoleOutput; | ||
} | ||
if (self.screenshot) { | ||
NSData *imageData = UIImagePNGRepresentation(self.screenshot); | ||
dictionary[DBCrashReportScreenshotKey] = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; | ||
} | ||
if (self.systemVersion) { | ||
dictionary[DBCrashReportSystemVersionKey] = self.systemVersion; | ||
} | ||
if (self.appVersion) { | ||
dictionary[DBCrashReportAppVersionKey] = self.appVersion; | ||
} | ||
|
||
return [dictionary copy]; | ||
} | ||
|
||
- (NSString *)dateString { | ||
return [NSDateFormatter localizedStringFromDate:self.date | ||
dateStyle:NSDateFormatterMediumStyle | ||
timeStyle:NSDateFormatterMediumStyle]; | ||
} | ||
|
||
@end |
48 changes: 48 additions & 0 deletions
48
DBDebugToolkit/Classes/CrashReports/DBCrashReportDetailsTableViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// The MIT License | ||
// | ||
// Copyright (c) 2017 Dariusz Bukowski | ||
// | ||
// 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 <UIKit/UIKit.h> | ||
#import "DBCrashReport.h" | ||
#import "DBBuildInfoProvider.h" | ||
#import "DBDeviceInfoProvider.h" | ||
|
||
/** | ||
`DBCrashReportDetailsTableViewController` is a view controller displaying the details of a crash report. | ||
*/ | ||
@interface DBCrashReportDetailsTableViewController : UITableViewController | ||
|
||
/** | ||
`DBCrashReport` instance containing all the details of the application crash. | ||
*/ | ||
@property (nonatomic, strong) DBCrashReport *crashReport; | ||
|
||
/** | ||
`DBBuildInfoProvider` instance providing build information displayed in the email subject. | ||
*/ | ||
@property (nonatomic, strong) DBBuildInfoProvider *buildInfoProvider; | ||
|
||
/** | ||
`DBDeviceInfoProvider` instance providing device information displayed in the email body. | ||
*/ | ||
@property (nonatomic, strong) DBDeviceInfoProvider *deviceInfoProvider; | ||
|
||
@end |
Oops, something went wrong.