Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/3.6.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Linde committed Apr 24, 2015
2 parents 336c2c6 + 05ce740 commit dc0b7ba
Show file tree
Hide file tree
Showing 105 changed files with 744 additions and 308 deletions.
4 changes: 2 additions & 2 deletions Classes/BITArrowImageAnnotation.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ - (void)buildShape {
}


if (abs(CGRectGetWidth(boundRect)) < 30 || abs(CGRectGetHeight(boundRect)) < 30){
CGFloat smallerOne = MIN(abs(CGRectGetHeight(boundRect)), abs(CGRectGetWidth(boundRect)));
if (fabs(CGRectGetWidth(boundRect)) < 30 || fabs(CGRectGetHeight(boundRect)) < 30){
CGFloat smallerOne = MIN(fabs(CGRectGetHeight(boundRect)), fabs(CGRectGetWidth(boundRect)));

CGFloat factor = smallerOne/30.f;

Expand Down
2 changes: 1 addition & 1 deletion Classes/BITAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ - (void)drawTextInRect:(CGRect)rect {

NSAttributedString *originalAttributedText = nil;

// Adjust the font size to fit width, if necessarry
// Adjust the font size to fit width, if necessary
if (self.adjustsFontSizeToFitWidth && self.numberOfLines > 0) {
CGFloat textWidth = [self sizeThatFits:CGSizeZero].width;
CGFloat availableWidth = self.frame.size.width * self.numberOfLines;
Expand Down
4 changes: 2 additions & 2 deletions Classes/BITAuthenticationViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
/**
* called when the user wants to login
*
* @param viewController the delegating viewcontroller
* @param viewController the delegating view controller
* @param email the content of the email-field
* @param password the content of the password-field (if existent)
* @param completion Must be called by the delegate once the auth-task completed
* This viewcontroller shows an activity-indicator in between and blocks
* This view controller shows an activity-indicator in between and blocks
* the UI. if succeeded is NO, it shows an alertView presenting the error
* given by the completion block
*/
Expand Down
4 changes: 2 additions & 2 deletions Classes/BITAuthenticator.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency)
*/
BITAuthenticatorAppRestrictionEnforcementOnFirstLaunch,
/**
* Checks if the user is allowed to use the app everytime the app becomes active
* Checks if the user is allowed to use the app every time the app becomes active
*/
BITAuthenticatorAppRestrictionEnforcementOnAppActive,
};
Expand Down Expand Up @@ -221,7 +221,7 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency)
- (NSURL*) deviceAuthenticationURL;

/**
* The url-scheme used to idenfify via `BITAuthenticatorIdentificationTypeDevice`
* The url-scheme used to identify via `BITAuthenticatorIdentificationTypeDevice`
*
* Please make sure that the URL scheme is unique and not shared with other apps.
*
Expand Down
20 changes: 7 additions & 13 deletions Classes/BITAuthenticator.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

@implementation BITAuthenticator {
id _appDidBecomeActiveObserver;
id _appDidEnterBackgroundOberser;
id _appDidEnterBackgroundObserver;
UIViewController *_authenticationController;

BOOL _isSetup;
Expand Down Expand Up @@ -160,13 +160,7 @@ - (void)alertOnFailureStoringTokenInKeychain {
return;
}

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
message:BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerStorageError")
delegate:self
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyOK")
otherButtonTitles:nil];
[alertView setTag:1];
[alertView show];
NSLog(@"[HockeySDK] ERROR: The authentication token could not be stored due to a keychain error. This is most likely a signing or keychain entitlement issue!");
}

- (void) identifyWithCompletion:(void (^)(BOOL identified, NSError *))completion {
Expand Down Expand Up @@ -795,8 +789,8 @@ - (void) registerObservers {
[strongSelf applicationDidBecomeActive:note];
}];
}
if(nil == _appDidEnterBackgroundOberser) {
_appDidEnterBackgroundOberser = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification
if(nil == _appDidEnterBackgroundObserver) {
_appDidEnterBackgroundObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification
object:nil
queue:NSOperationQueue.mainQueue
usingBlock:^(NSNotification *note) {
Expand All @@ -811,9 +805,9 @@ - (void) unregisterObservers {
[[NSNotificationCenter defaultCenter] removeObserver:_appDidBecomeActiveObserver];
_appDidBecomeActiveObserver = nil;
}
if(_appDidEnterBackgroundOberser) {
[[NSNotificationCenter defaultCenter] removeObserver:_appDidEnterBackgroundOberser];
_appDidEnterBackgroundOberser = nil;
if(_appDidEnterBackgroundObserver) {
[[NSNotificationCenter defaultCenter] removeObserver:_appDidEnterBackgroundObserver];
_appDidEnterBackgroundObserver = nil;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/BITCrashAttachment.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
Deprecated: Provides support to add binary attachments to crash reports
This class is not needed any longer and exists for compatiblity purposes with
This class is not needed any longer and exists for compatibility purposes with
HockeySDK-iOS 3.5.5.
It is a subclass of `BITHockeyAttachment` which only provides an initializer
Expand All @@ -50,7 +50,7 @@
@param crashAttachmentData The attachment data as NSData
@param contentType The content type of your data as MIME type
@return An instsance of BITCrashAttachment
@return An instance of BITCrashAttachment
*/
- (instancetype)initWithFilename:(NSString *)filename
crashAttachmentData:(NSData *)crashAttachmentData
Expand Down
4 changes: 2 additions & 2 deletions Classes/BITCrashDetails.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#import <Foundation/Foundation.h>

/**
* Provides details about the crash that occured in the previous app session
* Provides details about the crash that occurred in the previous app session
*/
@interface BITCrashDetails : NSObject

Expand Down Expand Up @@ -64,7 +64,7 @@
@property (nonatomic, readonly, strong) NSDate *appStartTime;

/**
* Date and time the crash occured, nil if unknown
* Date and time the crash occurred, nil if unknown
*/
@property (nonatomic, readonly, strong) NSDate *crashTime;

Expand Down
22 changes: 14 additions & 8 deletions Classes/BITCrashManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ typedef void (*BITCrashManagerPostCrashSignalCallback)(void *context);

/**
* This structure contains callbacks supported by `BITCrashManager` to allow the host application to perform
* additional tasks prior to program termination after a crash has occured.
* additional tasks prior to program termination after a crash has occurred.
*
* @see `BITCrashManagerPostCrashSignalCallback`
* @see `[BITCrashManager setCrashCallbacks:]`
Expand Down Expand Up @@ -140,9 +140,9 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
very slow.
It is possible to check upon startup if the app crashed before using `didCrashInLastSession` and also how much
time passed between the app launch and the crash using `timeintervalCrashInLastSessionOccured`. This allows you
time passed between the app launch and the crash using `timeIntervalCrashInLastSessionOccurred`. This allows you
to add additional code to your app delaying the app start until the crash has been successfully send if the crash
occured within a critical startup timeframe, e.g. after 10 seconds. The `BITCrashManagerDelegate` protocol provides
occurred within a critical startup timeframe, e.g. after 10 seconds. The `BITCrashManagerDelegate` protocol provides
various delegates to inform the app about it's current status so you can continue the remaining app startup setup
after sending has been completed. The documentation contains a guide
[How to handle Crashes on startup](HowTo-Handle-Crashes-On-Startup) with an example on how to do that.
Expand All @@ -164,7 +164,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
/** Set the default status of the Crash Manager
Defines if the crash reporting feature should be disabled, ask the user before
sending each crash report or send crash reportings automatically without
sending each crash report or send crash reports automatically without
asking.
The default value is `BITCrashManagerStatusAlwaysAsk`. The user can switch to
Expand Down Expand Up @@ -230,7 +230,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
* - The app tried to allocate too much memory. If iOS did send a memory warning before killing the app because of this reason, `didReceiveMemoryWarningInLastSession` returns `YES`.
* - Permitted background duration if main thread is running in an endless loop
* - App failed to resume in time if main thread is running in an endless loop
* - If `enableMachExceptionHandler` is not activated, crashed due to stackoverflow will also be reported
* - If `enableMachExceptionHandler` is not activated, crashed due to stack overflow will also be reported
*
* The following kills can _NOT_ be detected:
* - Terminating the app takes too long
Expand All @@ -244,7 +244,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
* The heuristic is implemented as follows:
* If the app never gets a `UIApplicationDidEnterBackgroundNotification` or `UIApplicationWillTerminateNotification`
* notification, PLCrashReporter doesn't detect a crash itself, and the app starts up again, it is assumed that
* the app got either killed by iOS while being in foreground or a crash occured that couldn't be detected.
* the app got either killed by iOS while being in foreground or a crash occurred that couldn't be detected.
*
* Default: _NO_
*
Expand Down Expand Up @@ -356,7 +356,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
- (void)setAlertViewHandler:(BITCustomAlertViewHandler)alertViewHandler;

/**
* Provides details about the crash that occured in the last app session
* Provides details about the crash that occurred in the last app session
*/
@property (nonatomic, readonly) BITCrashDetails *lastSessionCrashDetails;

Expand Down Expand Up @@ -400,7 +400,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
@see didCrashInLastSession
@see BITCrashManagerDelegate
*/
@property (nonatomic, readonly) NSTimeInterval timeintervalCrashInLastSessionOccured;
@property (nonatomic, readonly) NSTimeInterval timeIntervalCrashInLastSessionOccurred;


///-----------------------------------------------------------------------------
Expand Down Expand Up @@ -433,4 +433,10 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
*/
- (void)generateTestCrash;

///-----------------------------------------------------------------------------
/// @name Deprecated
///-----------------------------------------------------------------------------

@property (nonatomic, readonly) NSTimeInterval timeintervalCrashInLastSessionOccured DEPRECATED_MSG_ATTRIBUTE("Use the properly spelled property `timeIntervalCrashInLastSessionOccurred` instead.");

@end
25 changes: 17 additions & 8 deletions Classes/BITCrashManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ - (instancetype)init {
_crashIdenticalCurrentVersion = YES;

_didCrashInLastSession = NO;
_timeintervalCrashInLastSessionOccured = -1;
_timeIntervalCrashInLastSessionOccurred = -1;
_didLogLowMemoryWarning = NO;

_approvedCrashReports = [[NSMutableDictionary alloc] init];
Expand Down Expand Up @@ -349,14 +349,14 @@ - (BITHockeyAttachment *)attachmentForCrashReport:(NSString *)filename {
}

/**
* Extract all app sepcific UUIDs from the crash reports
* Extract all app specific UUIDs from the crash reports
*
* This allows us to send the UUIDs in the XML construct to the server, so the server does not need to parse the crash report for this data.
* The app specific UUIDs help to identify which dSYMs are needed to symbolicate this crash report.
*
* @param report The crash report from PLCrashReporter
*
* @return XML structure with the app sepcific UUIDs
* @return XML structure with the app specific UUIDs
*/
- (NSString *) extractAppUUIDs:(BITPLCrashReport *)report {
NSMutableString *uuidString = [NSMutableString string];
Expand Down Expand Up @@ -797,14 +797,12 @@ - (void) handleCrashReport {
if (report.systemInfo.timestamp && report.processInfo.processStartTime) {
appStartTime = report.processInfo.processStartTime;
appCrashTime =report.systemInfo.timestamp;
_timeintervalCrashInLastSessionOccured = [report.systemInfo.timestamp timeIntervalSinceDate:report.processInfo.processStartTime];
_timeIntervalCrashInLastSessionOccurred = [report.systemInfo.timestamp timeIntervalSinceDate:report.processInfo.processStartTime];
}
}

[crashData writeToFile:[_crashesDir stringByAppendingPathComponent: cacheFilename] atomically:YES];

[self storeMetaDataForCrashReportFilename:cacheFilename];

NSString *incidentIdentifier = @"???";
if (report.uuidRef != NULL) {
incidentIdentifier = (NSString *) CFBridgingRelease(CFUUIDCreateString(NULL, report.uuidRef));
Expand All @@ -823,6 +821,9 @@ - (void) handleCrashReport {
osBuild:report.systemInfo.operatingSystemBuild
appBuild:report.applicationInfo.applicationVersion
];

// fetch and store the meta data after setting _lastSessionCrashDetails, so the property can be used in the protocol methods
[self storeMetaDataForCrashReportFilename:cacheFilename];
}
}
}
Expand Down Expand Up @@ -959,7 +960,7 @@ - (void)invokeDelayedProcessing {
NSString *appName = bit_appName(BITHockeyLocalizedString(@"HockeyAppNamePlaceholder"));
NSString *alertDescription = [NSString stringWithFormat:BITHockeyLocalizedString(@"CrashDataFoundAnonymousDescription"), appName];

// the crash report is not anynomous any more if username or useremail are not nil
// the crash report is not anonymous any more if username or useremail are not nil
NSString *userid = [self userIDForCrashReport];
NSString *username = [self userNameForCrashReport];
NSString *useremail = [self userEmailForCrashReport];
Expand Down Expand Up @@ -1108,7 +1109,11 @@ - (void)startManager {
}
}
}
[self appEnteredForeground];

if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive) {
[self appEnteredForeground];
}

[[NSUserDefaults standardUserDefaults] setBool:NO forKey:kBITAppDidReceiveLowMemoryNotification];
[[NSUserDefaults standardUserDefaults] synchronize];

Expand Down Expand Up @@ -1520,6 +1525,10 @@ - (void)sendCrashReportWithFilename:(NSString *)filename xml:(NSString*)xml atta
[self.hockeyAppClient enqeueHTTPOperation:operation];
}

- (NSTimeInterval)timeintervalCrashInLastSessionOccured {
return self.timeIntervalCrashInLastSessionOccurred;
}

@end

#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */
Expand Down
23 changes: 22 additions & 1 deletion Classes/BITCrashReportTextFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

#import <Foundation/Foundation.h>

#import <CrashReporter/PLCrashReport.h>
@class PLCrashReport;


// Dictionary keys for array elements returned by arrayOfAppUUIDsForCrashReport:
#ifndef kBITBinaryImageKeyUUID
Expand All @@ -44,11 +45,31 @@
#endif


/**
* HockeySDK Crash Reporter error domain
*/
typedef NS_ENUM (NSInteger, BITBinaryImageType) {
/**
* App binary
*/
BITBinaryImageTypeAppBinary,
/**
* App provided framework
*/
BITBinaryImageTypeAppFramework,
/**
* Image not related to the app
*/
BITBinaryImageTypeOther
};


@interface BITCrashReportTextFormatter : NSObject {
}

+ (NSString *)stringValueForCrashReport:(PLCrashReport *)report crashReporterKey:(NSString *)crashReporterKey;
+ (NSArray *)arrayOfAppUUIDsForCrashReport:(PLCrashReport *)report;
+ (NSString *)bit_archNameFromCPUType:(uint64_t)cpuType subType:(uint64_t)subType;
+ (BITBinaryImageType)bit_imageTypeForImagePath:(NSString *)imagePath processPath:(NSString *)processPath;

@end
Loading

0 comments on commit dc0b7ba

Please sign in to comment.