Authorizing Clients on iOS
This how-to describes how to enable the authorization feature of HockeyKit in your app. With authorization, each new version checks against the server if the device is allowed to install the app. If not, HockeyKit will overlay your app with a custom view, effectively blocking access to the UI.
- HockeySDK-iOS is already integrated into your app. If not, please follow this tutorial.
- Your app is distributed with an iOS Ad-Hoc Provisioning Profile. iOS Enterprise can not be used with this feature.
Modify Source Code
- Open your AppDelegate.m file.
- Search for the method application:didFinishLaunchingWithOptions:
Search the following line in it:
[[BITHockeyManager sharedHockeyManager] configureWithBetaIdentifier:@"BETA_IDENTIFIER"
liveIdentifier:@"LIVE_IDENTIFIER" delegate:self]; [[BITHockeyManager sharedHockeyManager] startManager];
Add the following lines below this line:
[[BITHockeyManager sharedHockeyManager].updateManager setRequireAuthorization:YES]; [[BITHockeyManager sharedHockeyManager].updateManager setAuthenticationSecret:@"SECRET"];
Replace SECRET with the value on your app page. To find it, click on your app's icon on the dashboard, then search for "Secret" in the section "App Info". You can copy the value to the clipboard by clicking on the small clip besides "Secret".
Make sure that the bundle identifier in your Info.plist matches with the value on HockeyApp. Also note that the version must exist on HockeyApp before you can run the app, so you probably want to disable this feature for debug builds.