Introduction
HockeySDK-iOS implements support for using HockeyApp in your iOS applications.
The following features are currently supported:
-
Update apps: The app will check with HockeyApp if a new version is available. If yes, it will show an alert view to the user and let him see the release notes, the version history and start the installation process right away.
-
Collect crash reports: If you 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!
The main SDK class is BITHockeyManager
. It initializes all modules and provides access to them, so they can be further adjusted if required. Additionally all modules provide their own protocols.
Prerequisites
- Before you integrate HockeySDK into your own app, you should add the app to HockeyApp if you haven't already. Read this how-to on how to do it.
- We also assume that you already have a project in Xcode and that this project is opened in Xcode 4.
- The SDK supports iOS 4.0 or newer.
Versioning
We suggest to handle beta and release versions in two separate apps on HockeyApp with their own bundle identifier (e.g. by adding "beta" to the bundle identifier), so
- both apps can run on the same device or computer at the same time without interfering,
- release versions do not appear on the beta download pages, and
- easier analysis of crash reports and user feedback.
We propose the following method to set version numbers in your beta versions:
- Use both
Bundle Version
andBundle Version String, short
in your Info.plist. - "Bundle Version" should contain a sequential build number, e.g. 1, 2, 3.
- "Bundle Version String, short" should contain the target official version number, e.g. 1.0.
Installation with binary distribution
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.
Integrate into Xcode
- Drag & drop the
HockeySDK-iOS
folder 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
.
Installation as Git Submodule
Adding the 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
Add HockeySDK to your project
- 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
Target Dependencies
. - Add the following dependencies:
- HockeySDKLib
- HockeySDKResources
- Expand
Link Binary With Libraries
. - Add
libHockeySDK.a
- Drag & Drop
CrashReporter.framework
from theFrameworks
folder inHockeySDK.xcodeproj
- Expand
Copy Bundle Resources
. - Drag & Drop
HockeySDKResources.bundle
from theProducts
folder inHockeySDK.xcodeproj
Finish configuring your target
-
Select your project in the
Project Navigator
(⌘+1). -
Select your target.
-
Select the tab
Build Phases
. -
Expand
Link Binary With Libraries
. -
You need all of the following frameworks:
- CoreGraphics.framework
- Foundation.framework
- QuartzCore.framework
- SystemConfiguration.framework
- UIKit.framework
-
If one of the frameworks is missing, then click the + button, search the framework and confirm with the
Add
button. -
In
Header Search Paths
, add a path to$(SRCROOT)\Vendor\HockeyKit\Classes
-
Select
Build Settings
-
Search for
Other Linker Flags
-
Double click on the build Setting titled Other Linker Flags.
-
Add
-ObjC
-
Hit
Done
. -
HockeySDK-iOS also needs a JSON library. If you deployment target iOS >= 5, everything is set. If your deployment target is iOS 4.x, please include one of the following libraries:
Setup HockeySDK
- 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() <BITHockeyManager, BITUpdateManager, BITCrashManager> {} @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. - Add the following method:
This assumes that the Xcode build configuration used for App Store builds is named- (NSString *)customDeviceIdentifierForUpdateManager:(BITUpdateManager *)updateManager { #ifndef CONFIGURATION_AppStore if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) return [[UIDevice currentDevice] performSelector:@selector(uniqueIdentifier)]; #endif return nil; }
AppStore
. Repleace this string with the appropriate Xcode configuration name. - If you have added the lines to
application:didFinishLaunchingWithOptions:
, you should be ready to go. If you do some GCD magic or added the lines at a different place, please make sure to invoke the above code on the main thread.
Upload the .dSYM File
Once you have your app ready for beta testing or even to submit it to the App Store, you need to upload the .dSYM
bundle to HockeyApp to enable symbolication. If you have built your app with Xcode4, menu Product
> Archive
, you can find the .dSYM
as follows:
- Chose
Window
>Organizer
in Xcode. - Select the tab Archives.
- Select your app in the left sidebar.
- Right-click on the latest archive and select
Show in Finder
. - Right-click the
.xcarchive
in Finder and selectShow Package Contents
. - You should see a folder named dSYMs which contains your dSYM bundle. If you use Safari, just drag this file from Finder and drop it on to the corresponding drop zone in HockeyApp. If you use another browser, copy the file to a different location, then right-click it and choose Compress
YourApp.dSYM
. The file will be compressed as a .zip file. Drag & drop this file to HockeyApp.
As an alternative for step 5 and 6, you can use our HockeyMac app to upload the complete archive in one step. You can even integrate HockeyMac into Xcode to automatically show the upload interface after archiving your app, which would make all steps 1 to 6 not necessary any more!
Checklist if Crashes Do Not Appear in HockeyApp
- Check if the
BETA_IDENTIFIER
orLIVE_IDENTIFIER
matches the App ID in HockeyApp. - Check if CFBundleIdentifier in your Info.plist matches the Bundle Identifier of the app in HockeyApp. HockeyApp accepts crashes only if both the App ID and the Bundle Identifier equal their corresponding values in your plist and source code.
- Unless you have set
[BITCrashManager setCrashManagerStatus:]
toBITCrashManagerStatusAutoSubmit
: If your app crashes and you start it again, is the alert shown which asks the user to send the crash report? If not, please crash your app again, then connect the debugger and set a break point inBITCrashManager.m
, methodstartManager
to see why the alert is not shown. - If it still does not work, please contact us.