License | MIT |
ReleasedLast Release | Feb 2020 |
Maintained by Microsoft, Lukas Spieß, Clement Polet, Jae Lim, Alexander Chocron.
HockeySDK-tvOS implements support for using HockeyApp in your tvOS applications.
The following features are currently supported:
Collect crash reports: If your app crashes, a crash log with the same format as from the Apple Crash Reporter is written to the device's storage. If the user starts the app again, he is asked to submit the crash report to HockeyApp. This works for both beta and live apps, i.e. those submitted to the App Store.
User Metrics: Understand user behavior to improve your app. Track usage through daily and monthly active users, monitor crash impacted users, as well as customer engagement through session count. You can now track Custom Events in your app, understand user actions and see the aggregates on the HockeyApp portal.
Update notifications: The app will check with HockeyApp if a new version for your Ad-Hoc or Enterprise build is available. If yes, it will show an alert view with informations to the moste recent version.
Authenticate: Identify and authenticate users of Ad-Hoc or Enterprise builds
This document contains the following sections:
[NOTE] Be aware that tvOS requires Bitcode.
We recommend integration of our binary into your Xcode project to setup HockeySDK for your tvOS app.
Please see the "How to create a new app" tutorial. This will provide you with an HockeyApp-specific App Identifier to be used to initialize the SDK.
HockeySDK-tvOS
. (Be sure not to use 3rd-party unzip tools!)Move the unzipped HockeySDK-tvOS
folder into your project directory. In our experience, most projects will have a directory specifically set aside for 3rd-party libraries. These instructions assume that your project has such a directory, and that it is called Vendor
.
Vendor
, matching the directory.Project Navigator
is visible (⌘+1)HockeySDK.framework
from your window in Finder
(this would be the Vendor
directory) into your project in Xcode, and move it to the desired location in the Project Navigator
(e.g., into the group called Vendor
)Create groups for any added folders
, and check the checkbox for your target. Be sure to select your tvOS target if you have more than one. Now click Finish
.Objective-C
AppDelegate.m
in a default project).import
statements:@import HockeySDK;
application:didFinishLaunchingWithOptions:
, add the following lines to initialize and start the HockeySDK:[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
// Do additional configuration if needed here
[[BITHockeyManager sharedHockeyManager] startManager];
[[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation];
Swift 3
AppDelegate.swift
in a default project).import
statements:import HockeySDK
application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
,
add the following lines to initialize and start the HockeySDK:BITHockeyManager.shared().configure(withIdentifier: appId)
BITHockeyManager.shared().start()
BITHockeyManager.shared().authenticator.authenticateInstallation() // This line is obsolete in the crash only builds
Note: The SDK has been optimized to defer as much initialization as it can until needed, while still making sure that crashes on startup can be caught. Each module executes other code with a delay of up to several seconds. This ensures that your startup method will execute as fast as possible and that the SDK will not block the launch process (which would be a poor user experience and potentially result in your app being killed by the system watchdog process).
Make sure to read the article in our knowledgebase about Bitcode to make sure your crashes are symbolicated correctly.
Congratulations, you're all set to use HockeySDK!
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like HockeySDK in your projects. To learn how to setup CocoaPods for your project, visit the official CocoaPods website.
Podfile
platform :tvos, '10.0'
pod 'HockeySDK-tvOS'
As the current release we provide is an beta version, crash reporting currently has limited configuration and fine-tuning options.
The HockeySDK enables crash reporting by default. Crashes will be immediately sent to the server the next time the app is launched.
To provide you with the best crash reporting, we use a custom fork of Plausible Labs' PLCrashReporter at Commit b1b94c016f9661af13bdf6295c3cd55cc7d6a56f.
This feature can be disabled with the following code:
Objective-C
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
[[BITHockeyManager sharedHockeyManager] setDisableCrashManager:YES]; //disable crash reporting
[[BITHockeyManager sharedHockeyManager] startManager];
Swift 3
BITHockeyManager.shared().configureWithIdentifier("APP_IDENTIFIER")
BITHockeyManager.shared().isCrashManagerDisabled = true
BITHockeyManager.shared().startManager()
Crashes are sent the next time the app starts, without any user interaction.
The SDK avoids sending the reports at the time of the crash, as it is not possible to implement such a mechanism safely. In particular, there is no way to do network access in an async-safe fashion without causing a severe drain on the device's resources, and any error whatsoever creates the danger of a double-fault or deadlock, resulting in losing the crash report entirely. We have found that users do relaunch the app, because most don't know what happened, and you will receive the vast majority of crash reports.
Sending pending crash reports on startup is done asynchronously, using NSURLSession
. This avoids any issues with slow startup and is resilient against poor network connectivity.
The BITHockeyManagerDelegate
protocol provides methods to add additional data to a crash report:
- (NSString *)userIDForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager;
- (NSString *)userNameForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager;
- (NSString *)userEmailForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager;
The BITCrashManagerDelegate
protocol (which is automatically included in BITHockeyManagerDelegate
) provides methods to add more crash specific data to a crash report:
-(NSString *)applicationLogForCrashManager:(BITCrashManager *)crashManager
Check the following tutorial for an example on how to add CocoaLumberjack log data: How to Add Application Specific Log Data on iOS or OS X
2. Binary attachments: -(BITHockeyAttachment *)attachmentForCrashManager:(BITCrashManager *)crashManager
Make sure to implement the protocol
Objective-C
@interface YourAppDelegate () <BITHockeyManagerDelegate> {}
@end
Swift 3
class ViewController: UIViewController, BITHockeyManagerDelegate { .... }
and set the delegate:
Objective-C
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
[[BITHockeyManager sharedHockeyManager] setDelegate: self];
[[BITHockeyManager sharedHockeyManager] startManager];
Swift 3
BITHockeyManager.shared().configure(withIdentifier: "APP_IDENTIFIER")
BITHockeyManager.shared().delegate = self
BITHockeyManager.shared().start()
HockeyApp automatically provides you with nice, intelligible, and informative metrics about how your app is used and by whom.
Just in case you want to opt-out of the automatic collection of anonymous users and sessions statistics, there is a way to turn this functionality off at any time:
Objective-C
[BITHockeyManager sharedHockeyManager].disableMetricsManager = YES;
Swift 3
BITHockeyManager.shared().isMetricsManagerDisabled = true
By tracking custom events, you can now get insight into how your customers use your app, understand their behavior and answer important business or user experience questions while improving your app.
Objective-C
BITMetricsManager *metricsManager = [BITHockeyManager sharedHockeyManager].metricsManager;
[metricsManager trackEventWithName:eventName]
Swift 3
let metricsManager = BITHockeyManager.shared().metricsManager
metricsManager.trackEvent(withName:eventName)
Limitations
It's possible to attach properties and/or measurements to a custom event.
Objective-C
BITMetricsManager *metricsManager = [BITHockeyManager sharedHockeyManager].metricsManager;
NSDictionary *myProperties = @{@"Property 1" : @"Something",
@"Property 2" : @"Other thing",
@"Property 3" : @"Totally different thing"};
NSDictionary *myMeasurements = @{@"Measurement 1" : @1,
@"Measurement 2" : @2.34,
@"Measurement 3" : @2000000};
[metricsManager trackEventWithName:eventName properties:myProperties measurements:myMeasurements]
Swift 3
let myProperties = ["Property 1": "Something", "Property 2": "Other thing", "Property 3" : "Totally different thing."]
let myMeasurements = ["Measurement 1": 1, "Measurement 2": 2.3, "Measurement 3" : 30000]
let metricsManager = BITHockeyManager.shared().metricsManager
metricsManager.trackEvent(withName: eventName, properties: myProperties, myMeasurements: measurements)
The following options only show some of possibilities to interact and fine-tune the update feature when using Ad-Hoc or Enterprise provisioning profiles. For more please check the full documentation of the BITUpdateManager
class in our documentation.
The feature presents update and version information in pop over window.
This module automatically disables itself when running in an App Store build by default!
In-App-Update notifications can be disabled manually as follows:
Objective-C
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
[[BITHockeyManager sharedHockeyManager] setDisableUpdateManager: YES]; //disable auto updating
[[BITHockeyManager sharedHockeyManager] startManager];
Swift 3
BITHockeyManager.shared().configure(withIdentifier: "APP_IDENTIFIER")
BITHockeyManager.shared().isUpdateManagerDisabled = true //disable auto updating
BITHockeyManager.shared().start()
To check if data was sent properly to HockeyApp and also see some additional SDK debug loggging data in the console, add the following line before startManager
:
Objective-C
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
[BITHockeyManager sharedHockeyManager].logLevel = BITLogLevelDebug;
[[BITHockeyManager sharedHockeyManager] startManager];
Swift 3
BITHockeyManager.shared().configure(withIdentifier: appId)
BITHockeyManager.shared().logLevel = .verbose
BITHockeyManager.shared().start()
Our documentation can be found at HockeyApp.
Make sure none of the following files are copied into your app bundle. This can be checked by examining the Copy Bundle Resources
item in the Build Phases
tab of your app target in the Xcode project, or by looking within the final .app
bundle after making your build:
HockeySDK.framework
(unless you've built your own version of the SDK as a dynamic framework - if you don't know what this means, you don't have to worry about it)de.bitstadium.HockeySDK-tvOS-5.0.0.docset
Enable debug output to the console to see additional information from the SDK as it initializes modules, sends and receives network requests, and more, by adding the following code before calling startManager
:
`[BITHockeyManager sharedHockeyManager].logLevel = BITLogLevelDebug;`
We're looking forward to your contributions via pull requests.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
You must sign a Contributor License Agreement before opening a pull request. To complete the Contributor License Agreement (CLA), you must submit a request via this form, then electronically sign the CLA once you receive the email containing the link to the document. Signing the CLA once, for any project, covers all submissions to all Microsoft OSS projects, unless otherwise noted.
If you have further questions or run into trouble that cannot be resolved by any of the information here, feel free to open a Github issue, or contact us at [email protected].