# BITUpdateManager Class Reference

Inherits from | BITHockeyBaseManager : NSObject
Conforms to | UIAlertViewDelegate
Declared in | BITUpdateManager.h

## Overview

The update manager module.

This is the HockeySDK module for handling app updates when using Ad-Hoc or Enterprise provisioning profiles. This modul handles version updates, presents update and version information in a App Store like user interface, collects usage information and provides additional authorization options when using Ad-Hoc provisioning profiles.

This module automatically disables itself when running in an App Store build by default! If you integrate the Atlassian JMC client this module is used to automatically configure JMC, but will not do anything else.

The protocol `BITUpdateManagerDelegate` provides delegates to inform about events and adjust a few behaviors.

To use the server side restriction feature, to provide updates only to specific users, you need to setup the `BITAuthenticator` class. This allows the update request to tell the server which user is using the app on the current device and then let the server decide which updates the device may see.

## Tasks

### Delegate

- `delegate` property

### Update Checking

- `updateSetting` property
- `checkForUpdateOnLaunch` property
- `– checkForUpdate`

### Update Notification

- `alwaysShowUpdateReminder` property
- `showDirectInstallOption` property

### Expiry

- `expiryDate` property
- `disableUpdateCheckOptionWhenExpired` property

### User Interface

- `– showUpdateView`
- `– hockeyViewController:`

## Properties

### alwaysShowUpdateReminder

Flag that determines if updates alert should be repeatedly shown

`@property (nonatomic, assign) BOOL alwaysShowUpdateReminder`

#### Discussion

If enabled the update alert shows on every startup and whenever the app becomes active, until the update is installed. If disabled the update alert is only shown once ever and it is up to you to provide an alternate way for the user to navigate to the update UI or update in another way.

When running the app from the App Store, this setting is ignored.

Default: YES

#### Declared In

`BITUpdateManager.h`

### checkForUpdateOnLaunch

Flag that determines whether the automatic update checks should be done.

`@property (nonatomic, assign, getter=isCheckForUpdateOnLaunch) BOOL checkForUpdateOnLaunch`

#### Discussion

If this is enabled the update checks will be performed automatically depending on the `updateSetting` property. If this is disabled the `updateSetting` property will have no effect, and checking for updates is totally up to be done by yourself.

When running the app from the App Store, this setting is ignored.

Default: YES

Warning: When setting this to `NO` you need to invoke update checks yourself!

#### See Also

- `

  @property updateSetting

  `
- `

  - checkForUpdate

  `

#### Declared In

`BITUpdateManager.h`

### delegate

Sets the `BITUpdateManagerDelegate` delegate.

`@property (nonatomic, weak) id delegate`

#### Declared In

`BITUpdateManager.h`

### disableUpdateCheckOptionWhenExpired

Disable the update check button from expiry screen or alerts

`@property (nonatomic) BOOL disableUpdateCheckOptionWhenExpired`

#### Discussion

If do not want your users to be able to check for updates once a version is expired, then enable this property.

If this is not enabled, the users will be able to check for updates and install them if any is available for the current device.

Default: NO

Warning: This only works when using Ad-Hoc provisioning profiles!

#### See Also

- `

  @property expiryDate

  `
- `

  [BITUpdateManagerDelegate shouldDisplayExpiryAlertForUpdateManager:]

  `
- `

  [BITUpdateManagerDelegate didDisplayExpiryAlertForUpdateManager:]

  `

#### Declared In

`BITUpdateManager.h`

### expiryDate

Expiry date of the current app version

`@property (nonatomic, strong) NSDate *expiryDate`

#### Discussion

If set, the app will get unusable at the given date by presenting a blocking view on top of the apps UI so that no interaction is possible. To present a custom you, check the documentation of the `[BITUpdateManagerDelegate shouldDisplayExpiryAlertForUpdateManager:]` delegate.

Once the expiry date is reached, the app will no longer check for updates or send any usage data to the server!

When running the app from the App Store, this setting is ignored.

Default: nil

Warning: This only works when using Ad-Hoc provisioning profiles!

#### See Also

- `

  @property disableUpdateCheckOptionWhenExpired

  `
- `

  [BITUpdateManagerDelegate shouldDisplayExpiryAlertForUpdateManager:]

  `
- `

  [BITUpdateManagerDelegate didDisplayExpiryAlertForUpdateManager:]

  `

#### Declared In

`BITUpdateManager.h`

### showDirectInstallOption

Flag that determines if the update alert should show an direct install option

`@property (nonatomic, assign, getter=isShowingDirectInstallOption) BOOL showDirectInstallOption`

#### Discussion

If enabled the update alert shows an additional option which allows to invoke the update installation process directly, instead of viewing the update UI first. By default the alert only shows a `Show` and `Ignore` option.

When running the app from the App Store, this setting is ignored.

Default: NO

#### Declared In

`BITUpdateManager.h`

### updateSetting

When to check for new updates.

`@property (nonatomic, assign) BITUpdateSetting updateSetting`

#### Discussion

Defines when a the SDK should check if there is a new update available on the server. This must be assigned one of the following, see `BITUpdateSetting`:

- `BITUpdateCheckStartup`: On every startup or or when the app comes to the foreground
- `BITUpdateCheckDaily`: Once a day
- `BITUpdateCheckManually`: Manually

When running the app from the App Store, this setting is ignored.

Default: BITUpdateCheckStartup

Warning: When setting this to `BITUpdateCheckManually` you need to either invoke the update checking process yourself with `checkForUpdate` somehow, e.g. by proving an update check button for the user or integrating the Update View into your user interface.

#### See Also

- `

  BITUpdateSetting

  `
- `

  @property checkForUpdateOnLaunch

  `
- `

  - checkForUpdate

  `

#### Declared In

`BITUpdateManager.h`

## Instance Methods

### checkForUpdate

Check for an update

`- (void)checkForUpdate`

#### Discussion

Call this to trigger a check if there is a new update available on the HockeyApp servers.

When running the app from the App Store, this setting is ignored.

#### See Also

- `

  @property updateSetting

  `
- `

  @property checkForUpdateOnLaunch

  `

#### Declared In

`BITUpdateManager.h`

### hockeyViewController:

Create an update view

`- (BITUpdateViewController *)hockeyViewController:(BOOL)modal`

#### Parameters

modal

  Return a view ready for modal presentation with integrated navigation bar

#### Return Value

BITUpdateViewController The update user interface view controller, e.g. to push it onto a navigation stack.

#### Declared In

`BITUpdateManager.h`

### showUpdateView

Present the modal update user interface.

`- (void)showUpdateView`

#### Declared In

`BITUpdateManager.h`