iOS documentation

Basics

Doorbell requires iOS 9 or newer.

You can include Doorbell via CocoaPods. You can find it here

In the ViewController where you want to use Doorbell, you'll need to import the library using:

Swift
import Doorbell

Make sure you have use_frameworks! in your Podfile

Objective C
#import "Doorbell/Doorbell.h"

Attributes/Methods

There are 7 attributes that you can set on the Doorbell object: NSString *email, NSString *name, BOOL screenshot, BOOL nps, BOOL showEmail, BOOL animated, and BOOL showPoweredBy.

There are 4 methods that you can call on the Doorbell object: (id)initWithApiKey:(NSString *)apiKey appId:(NSString *)appID, (Doorbell*)doorbellWithApiKey:(NSString *)apiKey appId:(NSString *)appID, (void)addPropertyWithName:(NSString*)name AndValue:(id)value;, and (void)showFeedbackDialogInViewController:(UIViewController *)vc completion:(DoorbellCompletionBlock)completion.

Example (Swift)


    // In your ViewController
    let appId = "ID"
    let appKey = "KEY"

    let feedback = Doorbell.init(apiKey: appKey, appId: appId)

    // Pre-populate the email field if you know the email address
    feedback!.email = "hello@doorbell.io";

    // If we know the email address, we can set this to NO
    feedback!.showEmail = YES;

    // Set the name of the user if you know it, so you can see it in Doorbell
    feedback!.name = @"Philip";

    // If you want the dialog to animate when it appears
    feedback!.animated = YES;

    // Automatically attach a screenshot of the screen with the feedback
    feedback!.screenshot = YES;

    // Allow users to submit an NPS rating along with their feedback
    feedback!.nps = YES;

    // Add custom properties/metadata
    feedback!.addProperty(withName: "username", andValue: "manavo")
    feedback!.addProperty(withName: "account_id", andValue: 1234)

    feedback!.showFeedbackDialog(in: self, completion: { (error, cancelled) -> Void in
        if (error?.localizedDescription != nil) {
            print(error!.localizedDescription);
        }
    })
            

Example (Objective C)


    // In your ViewController
    NSString *appId = @"YOUR-APP-ID-GOES-HERE";
    NSString *appKey = @"YOUR-API-KEY-GOES-HERE";

    Doorbell *feedback = [Doorbell doorbellWithApiKey:appKey appId:appId];

    // Pre-populate the email field if you know the email address
    feedback.email = @"hello@doorbell.io";

    // If we know the email address, we can set this to NO
    feedback.showEmail = YES;

    // Set the name of the user if you know it, so you can see it in Doorbell
    feedback.name = @"Philip";

    // If you want the dialog to animate when it appears
    feedback.animated = YES;

    // Automatically attach a screenshot of the screen with the feedback
    feedback.screenshot = YES;

    // Allow users to submit an NPS rating along with their feedback
    feedback.nps = YES;

    // Add custom properties/metadata
    [feedback addPropertyWithName:@"username" AndValue:@"manavo"];
    [feedback addPropertyWithName:@"account_id" AndValue:[NSNumber numberWithInt:1234]];

    [feedback showFeedbackDialogInViewController:self completion:^(NSError *error, BOOL isCancelled) {
        if (error) {
            NSLog(@"%@", error.localizedDescription);
        }
    }];