6.5 KiB
Introduction
This article describes how to integrate HockeyApp into your iOS apps using a Git submodule and Xcode subprojects. 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
- Set up Git submodule
- Set up Xcode
- Modify Code
- Submit the UDID
- Mac Desktop Uploader
- Xcode Documentation
Requirements
The SDK runs on devices with iOS 4.0 or higher.
If you need support for iOS 3.x, please check out HockeyKit and QuincyKit
Set up Git submodule
-
Open a Terminal window
-
Change to your projects directory `cd /path/to/MyProject'
-
If this is a new project, initialize Git:
git init
-
Add the submodule:
git submodule add git://github.com/BitStadium/HockeySDK-iOS.git Vendor/HockeySDK
. This would add the submodule into theVendor/HockeySDK
subfolder. Change this to the folder you prefer.
Set up Xcode
-
Find the
HockeySDK.xcodeproj
file inside of the cloned HockeySDK-iOS project directory. -
Drag & Drop it into the
Project Navigator
(⌘+1). -
Select your project in the
Project Navigator
(⌘+1). -
Select your target.
-
Select the tab
Build Phases
. -
Expand
Link Binary With Libraries
. -
Add
libHockeySDK.a
-
Select
Add Other...
. -
Select
CrashReporter.framework
from theVendor/HockeySDK/Vendor
folder -
The following entries should be present:
libHockeySDK.a
CrashReporter.framework
CoreGraphics.framework
Foundation.framework
QuartzCore.framework
SystemConfiguration.framework
UIKit.framework
-
Expand
Copy Bundle Resources
. -
Drag & Drop
HockeySDKResources.bundle
from theProducts
folder inHockeySDK.xcodeproj
-
Select
Build Settings
-
Search for
Header Search Paths
-
Add a path to
$(SRCROOT)/Vendor/HockeySDK/Vendor
and make sure that the list does not contain a path pointing to theQuincyKit
SDK or another framework that containsPLCrashReporter
-
Hit
Done
. -
HockeySDK-iOS also needs a JSON library. If your deployment target iOS 5.0 or later, then you don't have to do anything. If your deployment target is iOS 4.x, please include one of the following libraries:
Modify Code
-
Open your
AppDelegate.m
file. -
Add the following line at the top of the file below your own #import statements:
#import "HockeySDK.h"
-
Let the AppDelegate implement the protocols
BITHockeyManagerDelegate
,BITUpdateManagerDelegate
andBITCrashManagerDelegate
:@interface AppDelegate() <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.
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. You can define the macro as follows:
-
Select your project in the
Project Navigator
(⌘+1). -
Select your target.
-
Select the tab
Build Settings
. -
Search for
preprocessor macros
-
Select the top-most line and double-click the value field.
-
Click the + button.
-
Enter the following string into the input field and finish with "Done".
CONFIGURATION_$(CONFIGURATION)
Now you can use #if defined (CONFIGURATION_AppStore)
statements in your code. If your configurations have different names, please adjust the above use of CONFIGURATION_AppStore
.
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.
-
Download the latest HockeySDK-iOS documentation.
-
Unzip the file. A new folder
HockeySDK-iOS-documentation
is created. -
Copy the content into ~
/Library/Developer/Shared/Documentation/DocSet