5.9 KiB
Introduction
This article describes how to integrate HockeyApp into your iOS apps. The SDK allows testers to update your app to another beta version right from within the application. It will notify the tester if a new update is available. The SDK also allows to send crash reports. If a crash has happened, it will ask the tester on the next start whether he wants to send information about the crash to the server.
This document contains the following sections:
- Requirements
- Download & Extract
- Set up Xcode
- Modify Code
- Submit the UDID
- Mac Desktop Uploader
- Xcode Documentation
Requirements
The SDK runs on devices with iOS 5.0 or higher.
If you need support for iOS 4.x, please check out HockeySDK v2.5.5
If you need support for iOS 3.x, please check out HockeyKit and QuincyKit
Download & Extract
-
Download the latest HockeySDK-iOS framework.
-
Unzip the file. A new folder
HockeySDK-iOS
is created. -
Move the folder into your project directory. We usually put 3rd-party code into a subdirectory named
Vendor
, so we move the directory into it.
Set up Xcode
-
Drag & drop
HockeySDK.embeddedframework
from your project directory to your Xcode project. -
Similar to above, our projects have a group
Vendor
, so we drop it there. -
Select
Create groups for any added folders
and set the checkmark for your target. Then clickFinish
. -
Select your project in the
Project Navigator
(⌘+1). -
Select your project.
-
Select the tab
Info
. -
Expand
Configurations
. -
Select
HockeySDK.xcconfig
for all your configurations (if you don't already use a.xcconfig
file) -
If you are already using a
.xcconfig
file, simply add the following line to it#include "../Vendor/HockeySDK/Support/HockeySDK.xcconfig"
(Adjust the path depending where the
Project.xcconfig
file is located related to the Xcode project package)Important note: Check if you overwrite any of the build settings and add a missing
$(inherited)
entry on the projects build settings level, so theHockeySDK.xcconfig
settings will be passed through successfully. -
If you are getting build warnings, then the
.xcconfig
setting wasn't included successfully or its settings inOther Linker Flags
get ignored because$(interited)
is missing on project or target level. Either add$(inherited)
or link the following frameworks manually inLink Binary With Libraries
underBuild Phases
:CoreText
CoreGraphics
Foundation
QuartzCore
SystemConfiguration
UIKit
Modify Code
-
Open your
AppDelegate.m
file. -
Add the following line at the top of the file below your own #import statements:
#import <HockeySDK/HockeySDK.h>
-
Let the AppDelegate implement the protocols
BITHockeyManagerDelegate
,BITUpdateManagerDelegate
andBITCrashManagerDelegate
:@interface AppDelegate(HockeyProtocols) <BITHockeyManagerDelegate, BITUpdateManagerDelegate, BITCrashManagerDelegate> {} @end
-
Search for the method
application:didFinishLaunchingWithOptions:
-
Add the following lines:
[[BITHockeyManager sharedHockeyManager] configureWithBetaIdentifier:@"BETA_IDENTIFIER" liveIdentifier:@"LIVE_IDENTIFIER" delegate:self]; [[BITHockeyManager sharedHockeyManager] startManager];
-
Replace
BETA_IDENTIFIER
with the app identifier of your beta app. If you don't know what the app identifier is or how to find it, please read this how-to. -
Replace
LIVE_IDENTIFIER
with the app identifier of your release app. We suggest to setup different apps on HockeyApp for your test and production builds. You usually will have way more test versions, but your production version usually has way more crash reports. This helps to keep data separated, getting a better overview and less trouble setting the right app versions downloadable for your beta users.
Submit the UDID
If you only want crash reporting, you can skip this step. If you want to use HockeyApp for beta distribution and analyze which testers have installed your app, you need to implement an additional delegate method in your AppDelegate.m:
#pragma mark - BITUpdateManagerDelegate
- (NSString *)customDeviceIdentifierForUpdateManager:(BITUpdateManager *)updateManager {
#ifndef CONFIGURATION_AppStore
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)])
return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)];
#endif
return nil;
}
The method only returns the UDID when the build is not targeted to the App Sore. This assumes that a preprocessor macro name CONFIGURATION_AppStore exists and is set for App Store builds. The macros are already defined in HockeySDK.xcconfig
.
Mac Desktop Uploader
The Mac Desktop Uploader can provide easy uploading of your app versions to HockeyApp. Check out the installation tutorial.
Xcode Documentation
This documentation provides integrated help in Xcode for all public APIs and a set of additional tutorials and HowTos.
- Copy
de.bitstadium.HockeySDK-iOS-3.0.0b5.docset
into ~/Library/Developer/Shared/Documentation/DocSet