More documentation updates

This commit is contained in:
Andreas Linde 2012-07-22 04:08:40 +02:00
parent 2257950c99
commit 8920cbc6c4
7 changed files with 190 additions and 38 deletions

View File

@ -50,15 +50,17 @@ typedef enum BITCrashStatus {
/**
The crash reporting module.
This is the principal SDK class. It represents the entry point for the HockeySDK. The main promises of the class are initializing the SDK modules, providing access to global properties and to all modules. Initialization is divided into several distinct phases:
This is the HockeySDK module for handling crash reports in any app version, including when distributed via
the App Store. As a foundation it is using the open source, reliable and async-safe crash reporting framework
(PLCrashReporter)[https://code.google.com/p/plcrashreporter/].
1. Setup the [HockeyApp](http://hockeyapp.net/) app identifier and the optional delegate: This is the least required information on setting up the SDK and using it. It does some simple validation of the app identifier and checks if the app is running from the App Store or not. If the [Atlassian JMC framework](http://www.atlassian.com/jmc/) is found, it will disable its Crash Reporting module and configure it with the Jira configuration data from [HockeyApp](http://hockeyapp.net/).
2. Provides access to the SDK modules `BITCrashManager` and `BITUpdateManager`. This way all modules can be further configured to personal needs, if the defaults don't fit the requirements.
3. Start up all modules.
This module works as a wrapper around the underlying crash reporting framework and provides functionality to
detect new crashes, queues them if networking is not available, present a user interface to approve sending
the reports to the HockeyApp servers and more.
Example:
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"<AppIdentifierFromHockeyApp>" delegate:nil];
[[BITHockeyManager sharedHockeyManager] startManager];
It also provides options to add additional meta information to each crash report, like `userName`, `userEmail`,
additional textual log information via `BITCrashManagerDelegate` protocol and a way to detect startup crashes so
you can adjust your startup process to get these crash reports too and delay your app initialization.
*/
@ -92,36 +94,111 @@ typedef enum BITCrashStatus {
BOOL _sendingInProgress;
}
// delegate is optional
///-----------------------------------------------------------------------------
/// @name Delegate
///-----------------------------------------------------------------------------
/**
Sets the optional `BITCrashManagerDelegate` delegate.
*/
@property (nonatomic, assign) id <BITCrashManagerDelegate> delegate;
///////////////////////////////////////////////////////////////////////////////////////////////////
// settings
///-----------------------------------------------------------------------------
/// @name Additional meta data
///-----------------------------------------------------------------------------
/** Define the users name or userid that should be send along each crash report
*/
@property (nonatomic, copy) NSString *userName;
/** Define the users email address that should be send along each crash report
*/
@property (nonatomic, copy) NSString *userEmail;
// if YES, the user will get the option to choose "Always" for sending crash reports. This will cause the dialog not to show the alert description text landscape mode! (default)
// if NO, the dialog will not show a "Always" button
///-----------------------------------------------------------------------------
/// @name Configuration
///-----------------------------------------------------------------------------
/**
Flag that determines if crashes should be send without user interaction
If enabled, new crashes will not cause an alert to show up asking the user
if he or she agrees on sending the crash report to the server.
By default a crash report is anonymous, unless you are adding personal information
using the `userName`, `userEmail` or `[BITCrashManagerDelegate applicationLogForCrashReporter:]`
options. For privacy reasons you should give the user an option not to send
the reports.
*Default*: _NO_
*/
@property (nonatomic, assign, getter=isAutoSubmitCrashReport) BOOL autoSubmitCrashReport;
/**
Flag that determines if an "Always" option should be shown
If enabled the crash reporting alert will also present an "Always" option, so
the user doesn't have to approve every single crash over and over again.
If `autoSubmitCrashReport` is enabled, this property has no effect, since no
alert will be presented.
@warning This will cause the dialog not to show the alert description text landscape mode!
@see autoSubmitCrashReport
*/
@property (nonatomic, assign, getter=isShowingAlwaysButton) BOOL showAlwaysButton;
// if YES, the user will be presented with a status of the crash, if known
// if NO, the user will not see any feedback information (default)
/**
Flag that determines if the user should get feedback about the crash
On the HockeyApp servers it is possible to assign each crash group a fixed app
version. Each app version also has a status like `new`, `submitted` or
`available`. This status defines what kind of feedback the user will get,
if the crash belongs to a crash group with a fixed version assigned.
The best case would be, that an update is already `available` which fixes this
crash.
*Default*: _NO_
*/
@property (nonatomic, assign, getter=isFeedbackActivated) BOOL feedbackActivated;
// if YES, the crash report will be submitted without asking the user
// if NO, the user will be asked if the crash report can be submitted (default)
@property (nonatomic, assign, getter=isAutoSubmitCrashReport) BOOL autoSubmitCrashReport;
// will return YES if the last session crashed, to e.g. make sure a "rate my app" alert will not show up
///-----------------------------------------------------------------------------
/// @name Crash Meta Information
///-----------------------------------------------------------------------------
/**
Indicates if the app crash in the previous session
Use this on startup, to check if the app starts the first time after it crashed
previously. You can use this also to disable specific events, like asking
the user to rate your app.
*/
@property (nonatomic, readonly) BOOL didCrashInLastSession;
// will return the timeinterval from startup to the crash in seconds, default is -1
/**
Provides the time between startup and crash in seconds
Use this in together with `didCrashInLastSession` to detect if the app crashed very
early after startup. This can be used to delay app initialization until the crash
report has been sent to the server or if you want to do any other actions like
cleaning up some cache data etc.
The `BITCrashManagerDelegate` protocol provides some delegates to inform if sending
a crash report was finished successfully, ended in error or was cancelled by the user.
@see didCrashInLastSession
@see BITCrashManagerDelegate
*/
@property (nonatomic, readonly) NSTimeInterval timeintervalCrashInLastSessionOccured;
@end

View File

@ -28,32 +28,66 @@
#import <Foundation/Foundation.h>
/**
The `BITCrashManagerDelegate` formal protocol defines methods further configuring
the behaviour of `BITCrashManager`.
*/
@protocol BITCrashManagerDelegate <NSObject>
@optional
///-----------------------------------------------------------------------------
/// @name Additional meta data
///-----------------------------------------------------------------------------
/** Return any log string based data the crash report being processed should contain
@param crashReporter The `BITCrashManager` instance invoking this delegate
*/
-(NSString *)applicationLogForCrashReporter:(BITCrashManager *)crashReporter;
///-----------------------------------------------------------------------------
/// @name Alert
///-----------------------------------------------------------------------------
/** Invoked before the user is asked to send a crash report, so you can do additional actions.
E.g. to make sure not to ask the user for an app rating :)
@param crashReporter The `BITCrashManager` instance invoking this delegate
*/
-(void)crashReporterWillShowSubmitCrashReportAlert:(BITCrashManager *)crashReporter;
/** Invoked after the user did choose to send crashes always in the alert
@param crashReporter The `BITCrashManager` instance invoking this delegate
*/
-(void)crashReporterWillSendCrashReportsAlways:(BITCrashManager *)crashReporter;
///-----------------------------------------------------------------------------
/// @name Networking
///-----------------------------------------------------------------------------
/** Invoked right before sending crash reports will start
@param crashReporter The `BITCrashManager` instance invoking this delegate
*/
- (void)crashReporterWillSendCrashReport:(BITCrashManager *)crashReporter;
/** Invoked after sending crash reports failed
@param crashReporter The `BITCrashManager` instance invoking this delegate
@param error The error returned from the NSURLConnection call or `kBITCrashErrorDomain`
with reason of type `BITCrashErrorReason`.
*/
- (void)crashReporter:(BITCrashManager *)crashReporter didFailWithError:(NSError *)error;
/** Invoked after sending crash reports succeeded
@param crashReporter The `BITCrashManager` instance invoking this delegate
*/
- (void)crashReporterDidFinishSendingCrashReport:(BITCrashManager *)crashReporter;

View File

@ -54,7 +54,6 @@ NSInteger binaryImageSort(id binary1, id binary2, void *context);
* the formatted result as a string.
*
* @param report The report to format.
* @param textFormat The text format to use.
*
* @return Returns the formatted result on success, or nil if an error occurs.
*/

View File

@ -48,19 +48,19 @@
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"<AppIdentifierFromHockeyApp>" delegate:nil];
[[BITHockeyManager sharedHockeyManager] startManager];
@warning **WARNING**: When using the SDK also for updating beta versions and collecting beta usage analytics,
you also have to to set the `delegate` property of `BITUpdateManager` and implement the `customDeviceIdentifierForUpdateManager:` delegate!
@warning When also using the SDK for updating app versions (AdHoc or Enterprise) and collecting
beta usage analytics, you also have to to set `[BITUpdateManager delegate]` and
implement `[BITUpdateManagerDelegate customDeviceIdentifierForUpdateManager:]`!
Example:
Example implementation if your Xcode configuration for the App Store is called "AppStore":
- (NSString *)customDeviceIdentifierForUpdateManager:(BITUpdateManager *)updateManager {
#ifdef CHECKFORBETA
#ifndef (CONFIGURATION_AppStore)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
return nil;
}
...
[[BITHockeyManager sharedHockeyManager].updateManager setDelegate:self];

View File

@ -32,8 +32,6 @@
/**
The `BITHockeyManagerDelegate` formal protocol defines methods further configuring
the behaviour of `BITHockeyManager`.
`BITHockeyManager` conforms to BITHockeyManagerDelegate.
*/
@protocol BITHockeyManagerDelegate <NSObject>

View File

@ -54,6 +54,30 @@ typedef enum {
@class BITAppVersionMetaInfo;
@class BITUpdateViewController;
/**
The update manager module.
This is the HockeySDK module for handling app updates when using Ad-Hoc or Enterprise provisioning profiles.
This modul handles version updates, presents update and version information in a App Store like user interface,
collects usage information and provides additional authorization options when using Ad-Hoc provisioning profiles.
To use this module, it is important to implement set the `delegate` property and implement
`[BITUpdateManagerDelegate customDeviceIdentifierForUpdateManager:]`.
Example implementation if your Xcode configuration for the App Store is called "AppStore":
- (NSString *)customDeviceIdentifierForUpdateManager:(BITUpdateManager *)updateManager {
#ifndef (CONFIGURATION_AppStore)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
return nil;
}
[[BITHockeyManager sharedHockeyManager].updateManager setDelegate:self];
*/
@interface BITUpdateManager : NSObject <UIAlertViewDelegate> {
@private
NSString *_appIdentifier;
@ -81,8 +105,8 @@ typedef enum {
Sets the `BITUpdateManagerDelegate` delegate.
When using `BITUpdateManager` to distribute updates of your beta or enterprise
application, it is required to set this delegate and implement the
`customDeviceIdentifierForUpdateManager:` delegate!
application, it is _REQUIRED_ to set this delegate and implement
`[BITUpdateManagerDelegate customDeviceIdentifierForUpdateManager:]`!
*/
@property (nonatomic, assign) id <BITUpdateManagerDelegate> delegate;
@ -123,7 +147,7 @@ typedef enum {
**Default**: BITUpdateCheckStartup
@warning **WARNING**: When setting this to `BITUpdateCheckManually` you need to either
@warning When setting this to `BITUpdateCheckManually` you need to either
invoke the update checking process yourself with `checkForUpdate` somehow, e.g. by
proving an update check button for the user or integrating the Update View into your
user interface.
@ -142,7 +166,7 @@ typedef enum {
*Default*: _YES_
@warning **WARNING**: When setting this to `NO` you need to invoke update checks yourself!
@warning When setting this to `NO` you need to invoke update checks yourself!
@see updateSetting
@see checkForUpdate
*/
@ -178,7 +202,7 @@ typedef enum {
*Default*: _YES_
@warning **WARNING**: When setting this to `NO`, you will know if this user is actually testing!
@warning When setting this to `NO`, you will know if this user is actually testing!
*/
@property (nonatomic, assign, getter=shouldSendUsageData) BOOL sendUsageData;
@ -226,6 +250,7 @@ typedef enum {
*Default*: _NO_
@see authenticationSecret
@warning This only works when using Ad-Hoc provisioning profiles!
*/
@property (nonatomic, assign, getter=isRequireAuthorization) BOOL requireAuthorization;

View File

@ -28,24 +28,43 @@
#import <Foundation/Foundation.h>
/**
The `BITUpdateManagerDelegate` formal protocol defines methods further configuring
the behaviour of `BITUpdateManager`.
*/
@protocol BITUpdateManagerDelegate <NSObject>
/*
/**
Return the unique device identifier
Return the device UDID which is required for beta testing, should return nil for app store configuration!
Example implementation if your configuration for the App Store is called "AppStore":
Example implementation if your Xcode configuration for the App Store is called "AppStore":
#ifndef (CONFIGURATION_AppStore)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
return nil;
- (NSString *)customDeviceIdentifierForUpdateManager:(BITUpdateManager *)updateManager {
#ifndef (CONFIGURATION_AppStore)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
return nil;
}
@param updateManager The `BITUpdateManager` instance invoking this delegate
*/
- (NSString *)customDeviceIdentifierForUpdateManager:(BITUpdateManager *)updateManager;
@optional
// optional parent view controller for the update screen when invoked via the alert view, default is the root UIWindow instance
/**
Provide a parent view controller for the update user interface
If you don't have a `rootViewController` set on your `UIWindow` and the SDK cannot
automatically find the current top most `UIViewController`, you can provide the
`UIViewController` that should be used to present the update user interface modal.
@param updateManager The `BITUpdateManager` instance invoking this delegate
*/
- (UIViewController *)viewControllerForUpdateManager:(BITUpdateManager *)updateManager;
@end