# BITFeedbackManager Class Reference

Inherits from | BITHockeyBaseManager : NSObject
Declared in | BITFeedbackManager.h

## Overview

The feedback module.

This is the HockeySDK module for letting your users to communicate directly with you via the app and an integrated user interface. It provides to have a single threaded discussion with a user running your app.

The user interface provides a list view than can be presented modally using `[BITFeedbackManager showFeedbackListView]` modally or adding `[BITFeedbackManager feedbackListViewController:]` to push onto a navigation stack. This list integrates all features to load new messages, write new messages, view message and ask the user for additional (optional) data like name and email.

If the user provides the email address, all responses from the server will also be send to the user via email and the user is also able to respond directly via email too.

The message list interface also contains options to locally delete single messages by swiping over them, or deleting all messages. This will not delete the messages on the server though!

It is also integrates actions to invoke the user interface to compose a new messages, reload the list content from the server and changing the users name or email if these are allowed to be set.

It is also possible to invoke the user interface to compose a new message in your own code, by calling `[BITFeedbackManager showFeedbackComposeView]` modally or adding `[BITFeedbackManager feedbackComposeViewController]` to push onto a navigation stack.

If new messages are written while the device is offline, the SDK automatically retries to send them once the app starts again or gets active again, or if the notification `BITHockeyNetworkDidBecomeReachableNotification` is fired.

A third option is to include the `BITFeedbackActivity` into an UIActivityViewController. This can be useful if you present some data that users can not only share but also report back to the developer because they have some problems, e.g. webcams not working any more. The activity provide a default title and image that can be also be customized.

New message are automatically loaded on startup, when the app becomes active again or when the notification `BITHockeyNetworkDidBecomeReachableNotification` is fired. This only happens if the user ever did initiate a conversation by writing the first feedback message.

Implementing the `BITFeedbackManagerDelegate` protocol will notify your app when a new message was received from the server. The `BITFeedbackComposeViewControllerDelegate` protocol informs your app about events related to sending feedback messages.

## Tasks

### Delegate

- `delegate` property

### General settings

- `requireUserName` property
- `requireUserEmail` property
- `showAlertOnIncomingMessages` property

### User Interface

- `showFirstRequiredPresentationModal` property
- `– showFeedbackListView`
- `– feedbackListViewController:`
- `– showFeedbackComposeView`
- `– feedbackComposeViewController`

## Properties

### delegate

Sets the `BITFeedbackManagerDelegate` delegate.

`@property (nonatomic, weak) id<BITFeedbackManagerDelegate> delegate`

#### Discussion

Can be set to be notified when new feedback is received from the server.

#### Declared In

`BITFeedbackManager.h`

### requireUserEmail

Define if an email address has to be provided by the user when providing feedback

`@property (nonatomic, readwrite) BITFeedbackUserDataElement requireUserEmail`

#### Discussion

If the user provides the email address, all responses from the server will also be send to the user via email and the user is also able to respond directly via email too.

- `BITFeedbackUserDataElementDontShow`: Don’t ask for this user data element at all
- `BITFeedbackUserDataElementOptional`: The user may provide it, but does not have to
- `BITFeedbackUserDataElementRequired`: The user has to provide this to continue

The default value is `BITFeedbackUserDataElementOptional`.

Warning: If you provide a non nil value for the `BITFeedbackManager` class via `[BITHockeyManagerDelegate userEmailForHockeyManager:componentManager:]` then this property will automatically be set to `BITFeedbackUserDataElementDontShow`

#### See Also

- `

  BITFeedbackUserDataElement

  `
- `

  @property requireUserName

  `
- `

  `[BITHockeyManagerDelegate userEmailForHockeyManager:componentManager:]`

  `

#### Declared In

`BITFeedbackManager.h`

### requireUserName

Define if a name has to be provided by the user when providing feedback

`@property (nonatomic, readwrite) BITFeedbackUserDataElement requireUserName`

#### Discussion

- `BITFeedbackUserDataElementDontShow`: Don’t ask for this user data element at all
- `BITFeedbackUserDataElementOptional`: The user may provide it, but does not have to
- `BITFeedbackUserDataElementRequired`: The user has to provide this to continue

The default value is `BITFeedbackUserDataElementOptional`.

Warning: If you provide a non nil value for the `BITFeedbackManager` class via `[BITHockeyManagerDelegate userNameForHockeyManager:componentManager:]` then this property will automatically be set to `BITFeedbackUserDataElementDontShow`

#### See Also

- `

  BITFeedbackUserDataElement

  `
- `

  @property requireUserEmail

  `
- `

  `[BITHockeyManagerDelegate userNameForHockeyManager:componentManager:]`

  `

#### Declared In

`BITFeedbackManager.h`

### showAlertOnIncomingMessages

Indicates if an alert should be shown when new messages arrived

`@property (nonatomic, readwrite) BOOL showAlertOnIncomingMessages`

#### Discussion

This lets the user to view the new feedback by choosing the appropriate option in the alert sheet, and the `BITFeedbackListViewController` will be shown.

The alert is only shown, if the newest message is not originated from the current user. This requires the users email address to be present! The optional userid property cannot be used, because users could also answer via email and then this information is not available.

Default is `YES`

#### See Also

- `

  - feedbackListViewController:

  `
- `

  @property requireUserEmail

  `
- `

  `[BITHockeyManagerDelegate userEmailForHockeyManager:componentManager:]`

  `

#### Declared In

`BITFeedbackManager.h`

### showFirstRequiredPresentationModal

Indicates if an forced user data UI presentation is shown modal

`@property (nonatomic, readwrite) BOOL showFirstRequiredPresentationModal`

#### Discussion

If `requireUserName` and/or `requireUserEmail` are enabled, the first presentation of `feedbackListViewController:` and subsequent `feedbackComposeViewController:` will automatically present a UI that lets the user provide this data and compose a message. By default this is shown (since SDK 3.1) as a modal sheet.

If you want the SDK to push this UI onto the navigation stack in this specific scenario, then change the property to `NO`.

Warning: If you presenting the `BITFeedbackListViewController` in a popover, this property should not be changed!

Default is `YES`

#### See Also

- `

  @property requireUserName

  `
- `

  @property requireUserEmail

  `
- `

  - showFeedbackComposeView

  `
- `

  - feedbackComposeViewController

  `
- `

  - showFeedbackListView

  `
- `

  - feedbackListViewController:

  `

#### Declared In

`BITFeedbackManager.h`

## Instance Methods

### feedbackComposeViewController

Create an feedback compose view

`- (BITFeedbackComposeViewController *)feedbackComposeViewController`

#### Return Value

`BITFeedbackComposeViewController` The compose feedback view controller, e.g. to push it onto a navigation stack.

#### Discussion

Example to show a modal feedback compose UI with prefilled text

     BITFeedbackComposeViewController *feedbackCompose = [[BITHockeyManager sharedHockeyManager].feedbackManager feedbackComposeViewController];

     [feedbackCompose prepareWithItems:
         @[@"Adding some example default text and also adding a link.",
         [NSURL URLWithString:@"http://hockeayyp.net/"]]];

     UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:feedbackCompose];
     navController.modalPresentationStyle = UIModalPresentationFormSheet;
     [self presentViewController:navController animated:YES completion:nil];

#### Declared In

`BITFeedbackManager.h`

### feedbackListViewController:

Create an feedback list view

`- (BITFeedbackListViewController *)feedbackListViewController:(BOOL)modal`

#### Parameters

modal

  Return a view ready for modal presentation with integrated navigation bar

#### Return Value

`BITFeedbackListViewController` The feedback list view controller, e.g. to push it onto a navigation stack.

#### Declared In

`BITFeedbackManager.h`

### showFeedbackComposeView

Present the modal feedback compose message user interface.

`- (void)showFeedbackComposeView`

#### Declared In

`BITFeedbackManager.h`

### showFeedbackListView

Present the modal feedback list user interface.

`- (void)showFeedbackListView`

#### Declared In

`BITFeedbackManager.h`