Buglife

@interface Buglife : NSObject

Buglife! Handles initialization and configuration of Buglife.

  • A mask of options specifying the way(s) that the Buglife bug reporter window can be invoked.

    You may choose to support multiple invocation options, e.g.:

    [Buglife sharedBuglife].invocationOptions = LIFEInvocationOptionsShake | LIFEInvocationOptionsScreenshot;
    

    This returns LIFEInvocationOptionsShake by default.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) LIFEInvocationOptions invocationOptions;

    Swift

    var invocationOptions: LIFEInvocationOptions { get set }
  • Specifies the retry policy for submitting bug reports. This returns LIFERetryPolicyNextLaunch by default.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) LIFERetryPolicy retryPolicy;

    Swift

    var retryPolicy: LIFERetryPolicy { get set }
  • Returns the SDK version.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) NSString *version;

    Swift

    var version: String { get }
  • The delegate can be used to configure various aspects of the Buglife reporter.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<BuglifeDelegate> delegate;

    Swift

    weak var delegate: BuglifeDelegate? { get set }
  • Default shared initializer that returns the Buglife singleton.

    Declaration

    Objective-C

    + (nonnull instancetype)sharedBuglife;

    Swift

    class func shared() -> Self

    Return Value

    The shared Buglife singleton

  • Enables Buglife bug reporting within your app.

    The recommended way to enable Buglife is to call this method in your app delegate’s -application:didFinishLaunchingWithOptions: method. Don’t worry, it won’t impact your app’s launch performance. 😉

    Declaration

    Objective-C

    - (void)startWithAPIKey:(nonnull NSString *)apiKey;

    Swift

    func start(withAPIKey apiKey: String)

    Parameters

    apiKey

    The Buglife API Key for your organization

  • Enables Buglife bug reporting within your app.

    Call this method with your own email address if you’d like to try out Buglife without signing up for an account. Bug reports will be sent directly to the provided email.

    This method should be called from within your app delegate’s -application:didFinishLaunchingWithOptions: method.

    Declaration

    Objective-C

    - (void)startWithEmail:(nonnull NSString *)email;

    Swift

    func start(withEmail email: String)

    Parameters

    email

    The email address to which bug reports should be sent. This email address should belong to you or someone on your team.

  • Immediately presents the Buglife bug reporter view controller. This is useful for apps that wish to supplement or replace the default invocation options, i.e. by placing a custom bug report button in their app settings.

    Declaration

    Objective-C

    - (void)presentReporter;

    Swift

    func presentReporter()
  • Specifies a user identifier that will be visible in the Buglife report viewer UI.

    Declaration

    Objective-C

    - (void)setUserIdentifier:(nullable NSString *)identifier;

    Swift

    func setUserIdentifier(_ identifier: String?)

    Parameters

    identifier

    An arbitrary string that identifies a user for your app.

  • Specifies an email address that will be visible in the Buglife report viewer UI.

    This should be set to the email address of the current user, if any. For example, if your app requires users to sign in, then you may wish to use the signed in user’s email address here to identify them when they submit bug reports.

    Declaration

    Objective-C

    - (void)setUserEmail:(nullable NSString *)email;

    Swift

    func setUserEmail(_ email: String?)

    Parameters

    email

    The current user’s email address

  • Adds custom data to bug reports. Set a nil value for a given attribute to delete its current value.

    Declaration

    Objective-C

    - (void)setStringValue:(nullable NSString *)value
              forAttribute:(nonnull NSString *)attribute;

    Swift

    func setStringValue(_ value: String?, forAttribute attribute: String)
  • Set this property if you’d like to use custom input fields. The bug reporter UI will display fields in this same order.

    Setting this property will override the default fields (i.e. What’s happening). If you’d like to use default system fields, you can use the corresponding LIFEInputField constructors, and include them in your array of custom input fields.

    Set this property to null if you’d like to simply use the default field(s).

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        NSArray<LIFEInputField *> *inputFields;

    Swift

    var inputFields: [LIFEInputField]? { get set }
  • Represents the email address input field in the bug reporter UI.

    If your application code cannot programmatically set the user’s email address at runtime via the setUserEmail: method, then you may choose to set this field to visible in order to ask the user for their email address prior to submitting a bug report.

    By default, this field is neither visible nor required.

    See

    setUserEmail(email:)

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) LIFEInputField *userEmailField;

    Swift

    var userEmailField: LIFEInputField { get }
  • Returns an appearance proxy that can be used to configure visual aspects of the bug reporter.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) id<LIFEAppearance> appearance;

    Swift

    var appearance: LIFEAppearance { get }
  • Adds an attachment to be uploaded along with the next bug report.

    Although you can add an attachment at any time, it is best to do so within buglife:handleAttachmentRequestWithCompletionHandler:. This ensures that your attachment is added once & only once for every submitted bug report.

    This method is thread-safe.

    Declaration

    Objective-C

    - (BOOL)addAttachmentWithData:(nonnull NSData *)data
                             type:(nonnull LIFEAttachmentType *)type
                         filename:(nonnull NSString *)filename
                            error:(NSError *_Nullable *_Nullable)error;

    Swift

    func addAttachment(with data: Data, type: String, filename: String) throws

    Parameters

    data

    The attachment data.

    type

    The type of attachment. This must be one of the Buglife-provided LIFEAttachmentType constants.

    filename

    The filename that this data should assume once submitted to the Buglife API.

    Return Value

    whether or not the attachment succeeded.

  • Convenience method for adding an image attachment.

    If necessary, images attached using this method may be automatically resized to fit within the 3 MB total limit for file attachments.

    See

    addAttachmentWithData(_:type:filename:)

    Declaration

    Objective-C

    - (void)addAttachmentWithImage:(nonnull UIImage *)image
                          filename:(nonnull NSString *)filename;

    Swift

    func addAttachment(withImage image: Any!, filename: String)

    Parameters

    image

    The image object to attach.

    filename

    The filename.

  • Renders & returns a screenshot of your application.

    This can be used to generate screenshots to manually attach when invoking the bug reporter using the presentReporter() method.

    Declaration

    Objective-C

    - (nonnull UIImage *)screenshot;

    Swift

    func screenshot() -> Any!
  • Sorry, Buglife is a singleton 😁 Please use the shared initializer Buglife.sharedBuglife()

    Declaration

    Objective-C

    - (null_unspecified instancetype)init;
  • Set this property to true to show Buglife string keys in the bug reporter flow that haven’t been overridden by your application.

    By default, this property returns false.

    Warning

    This property should only be used for debugging.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL showStringKeys;

    Swift

    var showStringKeys: Bool { get set }