Update BITCrashDetails and remove non needed properties in BITCrashManager

cleanup :)
This commit is contained in:
Andreas Linde 2014-05-20 12:03:22 +02:00
parent 0f117b27c5
commit 58f6854a5e
6 changed files with 143 additions and 47 deletions

View File

@ -1,10 +1,30 @@
//
// BITCrashDetails.h
// HockeySDK
//
// Created by Andreas Linde on 03.04.14.
//
//
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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 <Foundation/Foundation.h>
@ -50,13 +70,26 @@
*/
@property (nonatomic, readonly, strong) NSString *appBuild;
- (instancetype)initWithIncidentIdentifier:(NSString *)incidentIdentifier
reporterKey:(NSString *)reporterKey
signal:(NSString *)signal
exceptionName:(NSString *)exceptionName
exceptionReason:(NSString *)exceptionReason
appStartTime:(NSDate *)appStartTime
crashTime:(NSDate *)crashTime
appBuild:(NSString *)appBuild;
/**
Indicates if the app was killed while being in foreground from the iOS
If `[BITCrashManager enableAppNotTerminatingCleanlyDetection]` is enabled, use this on startup
to check if the app starts the first time after it was killed by iOS in the previous session.
This can happen if it consumed too much memory or the watchdog killed the app because it
took too long to startup or blocks the main thread for too long, or other reasons. See Apple
documentation: https://developer.apple.com/library/ios/qa/qa1693/_index.html
See `[BITCrashManager enableDectionAppKillWhileInForeground]` for more details about which kind of kills can be detected.
@warning This property only has a correct value, once `[BITHockeyManager startManager]` was
invoked! In addition, it is automatically disabled while a debugger session is active!
@see `[BITCrashManager enableAppNotTerminatingCleanlyDetection]`
@see `[BITCrashManager didReceiveMemoryWarningInLastSession]`
@return YES if the details represent an app kill instead of a crash
*/
- (BOOL)isAppKill;
@end

View File

@ -1,12 +1,35 @@
//
// BITCrashDetails.m
// HockeySDK
//
// Created by Andreas Linde on 03.04.14.
//
//
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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 "BITCrashDetails.h"
#import "BITCrashDetailsPrivate.h"
NSString *const kBITCrashKillSignal = @"SIGKILL";
@implementation BITCrashDetails
@ -32,4 +55,13 @@
return self;
}
- (BOOL)isAppKill {
BOOL result = NO;
if (_signal && [[_signal uppercaseString] isEqualToString:kBITCrashKillSignal])
result = YES;
return result;
}
@end

View File

@ -0,0 +1,46 @@
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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 <HockeySDK/HockeySDK.h>
extern NSString *const __attribute__((unused)) kBITCrashKillSignal;
@interface BITCrashDetails () {
}
- (instancetype)initWithIncidentIdentifier:(NSString *)incidentIdentifier
reporterKey:(NSString *)reporterKey
signal:(NSString *)signal
exceptionName:(NSString *)exceptionName
exceptionReason:(NSString *)exceptionReason
appStartTime:(NSDate *)appStartTime
crashTime:(NSDate *)crashTime
appBuild:(NSString *)appBuild;
@end

View File

@ -259,7 +259,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
* @warning This is a heuristic and it _MAY_ report false positives! It has been tested with iOS 6.1 and iOS 7.
* Depending on Apple changing notification events, new iOS version may cause more false positives!
*
* @see wasKilledInLastSession
* @see lastSessionCrashDetails
* @see didReceiveMemoryWarningInLastSession
* @see `BITCrashManagerDelegate considerAppNotTerminatedCleanlyReportForCrashManager:`
* @see [Apple Technical Note TN2151](https://developer.apple.com/library/ios/technotes/tn2151/_index.html)
@ -325,6 +325,8 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
@warning This property only has a correct value, once `[BITHockeyManager startManager]` was
invoked!
@see lastSessionCrashDetails
*/
@property (nonatomic, readonly) BOOL didCrashInLastSession;
@ -349,27 +351,6 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
*/
- (void) setAlertViewHandler:(BITCustomAlertViewHandler)alertViewHandler;
/**
Indicates if the app was killed while being in foreground from the iOS
If `enableAppNotTerminatingCleanlyDetection` is enabled, use this on startup to check if the
app starts the first time after it was killed by iOS in the previous session.
This can happen if it consumed too much memory or the watchdog killed the app because it
took too long to startup or blocks the main thread for too long, or other reasons. See Apple
documentation: https://developer.apple.com/library/ios/qa/qa1693/_index.html
See `enableDectionAppKillWhileInForeground` for more details about which kind of kills can be detected.
@warning This property only has a correct value, once `[BITHockeyManager startManager]` was
invoked! In addition, it is automatically disabled while a debugger session is active!
@see enableAppNotTerminatingCleanlyDetection
@see didReceiveMemoryWarningInLastSession
*/
@property (nonatomic, readonly) BOOL wasKilledInLastSession;
/**
* Provides details about the crash that occured in the last app session
*/
@ -392,7 +373,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
invoked!
@see enableAppNotTerminatingCleanlyDetection
@see wasKilledInLastSession
@see lastSessionCrashDetails
*/
@property (nonatomic, readonly) BOOL didReceiveMemoryWarningInLastSession;

View File

@ -43,6 +43,7 @@
#import "BITHockeyBaseManagerPrivate.h"
#import "BITCrashManagerPrivate.h"
#import "BITCrashReportTextFormatter.h"
#import "BITCrashDetailsPrivate.h"
#include <sys/sysctl.h>
@ -1056,7 +1057,6 @@ static PLCrashReporterCallbacks plCrashCallbacks = {
if (considerReport) {
[self createCrashReportForAppKill];
_wasKilledInLastSession = YES;
_didCrashInLastSession = YES;
}
}
@ -1084,7 +1084,7 @@ static PLCrashReporterCallbacks plCrashCallbacks = {
NSString *fakeReportDeviceModel = [self getDevicePlatform] ?: @"Unknown";
NSString *fakeReportAppUUIDs = [[NSUserDefaults standardUserDefaults] objectForKey:kBITAppUUIDs] ?: @"";
NSString *fakeSignalName = @"SIGKILL";
NSString *fakeSignalName = kBITCrashKillSignal;
NSMutableString *fakeReportString = [NSMutableString string];

View File

@ -129,6 +129,7 @@
1EAF20AA162DC0F600957B1D /* feedbackActiviy.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EAF20A6162DC0F600957B1D /* feedbackActiviy.png */; };
1EAF20AB162DC0F600957B1D /* feedbackActiviy@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1EAF20A7162DC0F600957B1D /* feedbackActiviy@2x.png */; };
1EB52FD5167B766100C801D5 /* HockeySDK.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1E59555F15B6F80E00A03429 /* HockeySDK.strings */; };
1ECA8F4D192B5BD8006B9416 /* BITCrashDetailsPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ECA8F4B192B5BD8006B9416 /* BITCrashDetailsPrivate.h */; };
1ED570C718BF878C00AB3350 /* BITCrashAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ED570C518BF878C00AB3350 /* BITCrashAttachment.h */; settings = {ATTRIBUTES = (Public, ); }; };
1ED570C818BF878C00AB3350 /* BITCrashAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ED570C618BF878C00AB3350 /* BITCrashAttachment.m */; };
1EF95CA6162CB037000AE3AD /* BITFeedbackActivity.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EF95CA4162CB036000AE3AD /* BITFeedbackActivity.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -289,6 +290,7 @@
1EAF20A6162DC0F600957B1D /* feedbackActiviy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = feedbackActiviy.png; sourceTree = "<group>"; };
1EAF20A7162DC0F600957B1D /* feedbackActiviy@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "feedbackActiviy@2x.png"; sourceTree = "<group>"; };
1EB52FC3167B73D400C801D5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/HockeySDK.strings; sourceTree = "<group>"; };
1ECA8F4B192B5BD8006B9416 /* BITCrashDetailsPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashDetailsPrivate.h; sourceTree = "<group>"; };
1ED570C518BF878C00AB3350 /* BITCrashAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashAttachment.h; sourceTree = "<group>"; };
1ED570C618BF878C00AB3350 /* BITCrashAttachment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashAttachment.m; sourceTree = "<group>"; };
1EDA60CF15C2C1450032D10B /* HockeySDK-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "HockeySDK-Info.plist"; sourceTree = "<group>"; };
@ -488,6 +490,7 @@
1E754E571621FBB70070AB92 /* BITCrashManager.m */,
1E90FD7118EDB86400CF0417 /* BITCrashDetails.h */,
1E90FD7218EDB86400CF0417 /* BITCrashDetails.m */,
1ECA8F4B192B5BD8006B9416 /* BITCrashDetailsPrivate.h */,
1EFF03D717F20F8300A5F13C /* BITCrashManagerPrivate.h */,
1E754E581621FBB70070AB92 /* BITCrashManagerDelegate.h */,
1ED570C518BF878C00AB3350 /* BITCrashAttachment.h */,
@ -652,6 +655,7 @@
1E49A44E1612223B00463151 /* BITFeedbackManager.h in Headers */,
E4B4DB7D17B435550099C67F /* BITAuthenticationViewController.h in Headers */,
1E49A4481612223B00463151 /* BITFeedbackListViewController.h in Headers */,
1ECA8F4D192B5BD8006B9416 /* BITCrashDetailsPrivate.h in Headers */,
1E49A47F1612226D00463151 /* BITUpdateViewController.h in Headers */,
1E49A43C1612223B00463151 /* BITFeedbackComposeViewController.h in Headers */,
E40E0B0C17DA1AFF005E38C1 /* BITHockeyAppClient.h in Headers */,