Instabug Class Reference

Inherits from NSObject
Declared in Instabug.h
Instabug.m

Overview

This is the API for using Instabug’s SDK. For more details about the SDK integration, please visit https://instabug.com/developers

SDK Initialization

+ startWithToken:invocationEvent:

Starts the SDK.

+ (void)startWithToken:(NSString *)token invocationEvent:(IBGInvocationEvent)invocationEvent

Parameters

token

The token that identifies the app, you can find it on your dashboard.

invocationEvent

The event that invokes the SDK’s UI.

Discussion

This is the main SDK method that does all the magic. This is the only method that SHOULD be called. Should be called at the end of [UIApplicationDelegate application:didFinishLaunchingWithOptions:].

Declared In

Instabug.h

SDK Manual Invocation

+ invoke

Invokes the SDK manually with the default invocation mode.

+ (void)invoke

Discussion

Shows a view that asks the user whether they want to start a chat, report a problem or suggest an improvement.

Declared In

Instabug.h

+ invokeWithInvocationMode:

Invokes the SDK with a specific mode.

+ (void)invokeWithInvocationMode:(IBGInvocationMode)invocationMode

Parameters

invocationMode

Specifies which mode the SDK is going to start with.

Discussion

Invokes the SDK and show a specific view, instead of showing a prompt for users to choose from.

Declared In

Instabug.h

+ dismiss

Dismisses any Instabug views that are currently being shown.

+ (void)dismiss

Declared In

Instabug.h

SDK Pro Features

+ setFileAttachment:

Attaches a file to each report being sent. (Deprecated: Use addFileAttachmentWithURL: instead.)

+ (void)setFileAttachment:(NSString *)fileLocation

Parameters

fileLocation

Path to a file that’s going to be attached to each report.

Discussion

A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy attached to your bug reports will always contain that latest changes at the time of sending the report.

Each call to this method overrides the file to be attached, and the file has to be available locally at the provided path when the report is being sent.

Declared In

Instabug.h

+ setFileAttachmentWithURL:

Attaches a file to each report being sent. (Deprecated: Use addFileAttachmentWithURL: instead.)

+ (void)setFileAttachmentWithURL:(NSURL *)fileURL

Parameters

fileURL

Path to a file that’s going to be attached to each report.

Discussion

A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy attached to your bug reports will always contain that latest changes at the time of sending the report.

Each call to this method overrides the file to be attached, and the file has to be available locally at the provided path when the report is being sent.

Declared In

Instabug.h

+ addFileAttachmentWithURL:

Add file to attached files with each report being sent.

+ (void)addFileAttachmentWithURL:(NSURL *)fileURL

Parameters

fileURL

Path to a file that’s going to be attached to each report.

Discussion

A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy attached to your bug reports will always contain that latest changes at the time of sending the report.

Each call to this method adds the file to the files attached, until a maximum of 3 then it overrides the first file. The file has to be available locally at the provided path when the report is being sent.

Declared In

Instabug.h

+ addFileAttachmentWithData:

Add a set of data as a file attachment to be sent with each report.

+ (void)addFileAttachmentWithData:(NSData *)data

Parameters

data

NSData to be added as a file attachment with each report.

Discussion

The data will be written to a file and will be attached with each report.

Each call to this method adds this set of data as a file attachment, until a maximum of 3 then it overrides the first data.

Declared In

Instabug.h

+ clearFileAttachments

Clear list of files to be attached with each report.

+ (void)clearFileAttachments

Discussion

This method doesn’t delete any files from the file system. It will just removes them for the list of files to be attached with each report.

Declared In

Instabug.h

+ setUserData:

Attaches user data to each report being sent.

+ (void)setUserData:(NSString *)userData

Parameters

userData

A string to be attached to each report, with a maximum size of 1,000 characters.

Discussion

Each call to this method overrides the user data to be attached. Maximum size of the string is 1,000 characters.

Declared In

Instabug.h

+ setUserStepsEnabled:

Sets whether the SDK is tracking user steps or not.

+ (void)setUserStepsEnabled:(BOOL)isUserStepsEnabled

Parameters

isUserStepsEnabled

A boolean to set user steps tracking to being enabled or disabled.

Discussion

Enabling user steps would give you an insight on the scenario a user has performed before encountering a bug or a crash. User steps are attached with each report being sent.

User Steps tracking is enabled by default if it’s available in your current plan.

Declared In

Instabug.h

+ setReproStepsMode:

Sets whether user steps tracking is visual, non visula or disabled.

+ (void)setReproStepsMode:(IBGUserStepsMode)userStepsMode

Parameters

userStepsMode

An enum to set user steps tracking to be enabled , non visual or disabled.

Discussion

Enabling user steps would give you an insight on the scenario a user has performed before encountering a bug or a crash. User steps are attached with each report being sent.

User Steps tracking is enabled by default if it’s available in your current plan.

Declared In

Instabug.h

+ setCrashReportingEnabled:

Sets whether to track and report crashes or not.

+ (void)setCrashReportingEnabled:(BOOL)isReportingCrashes

Parameters

isReportingCrashes

A boolean to set crash reporting to being enabled or disabled.

Discussion

When enabled, Instabug will automatically report crashes, which can be viewed later on from your dashboard.

Crash reporting is enabled by default if it’s available in your current plan.

Declared In

Instabug.h

+ setInAppConversationsEnabled:

Sets whether In-App Conversations button and notifications are displayed or not. (Deprecated: Starting from v6.0, use setPromptOptionsEnabled: instead.)

+ (void)setInAppConversationsEnabled:(BOOL)isInAppConversationsEnabled

Parameters

isInAppConversationsEnabled

A boolean to set In-App Conversations to being enabled or disabled.

Discussion

When In-App Conversations are disabled, push notifications are disabled as well.

In-App Conversations is enabled by default if it’s available in your current plan.

Declared In

Instabug.h

+ setPreSendingBlock:

Sets a block of code to be executed before sending each report. (Deprecated: Starting from v6.0, use setPreSendingHandler: instead.)

+ (void)setPreSendingBlock:(void ( ^ ) ( void ))preSendingBlock

Parameters

preSendingBlock

A block of code that gets executed before sending each bug report.

Discussion

This block is executed in the background before sending each report. Could be useful for attaching logs and extra data to reports.

Declared In

Instabug.h

+ setPreSendingHandler:

Sets a block of code to be executed before sending each report.

+ (void)setPreSendingHandler:(void ( ^ ) ( void ))preSendingHandler

Parameters

preSendingHandler

A block of code that gets executed before sending each bug report.

Discussion

This block is executed in the background before sending each report. Could be used for attaching logs and extra data to reports.

Declared In

Instabug.h

+ setPreInvocationBlock:

Sets a block of code to be executed just before the SDK’s UI is presented. (Deprecated: Starting from v6.0, use setPreInvocationHandler: instead.)

+ (void)setPreInvocationBlock:(void ( ^ ) ( void ))preInvocationBlock

Parameters

preInvocationBlock

A block of code that gets executed before presenting the SDK’s UI.

Discussion

This block is executed on the UI thread. Could be used for performing any UI changes before the SDK’s UI is shown.

Declared In

Instabug.h

+ setPreInvocationHandler:

Sets a block of code to be executed just before the SDK’s UI is presented.

+ (void)setPreInvocationHandler:(void ( ^ ) ( void ))preInvocationHandler

Parameters

preInvocationHandler

A block of code that gets executed before presenting the SDK’s UI.

Discussion

This block is executed on the UI thread. Could be used for performing any UI changes before the SDK’s UI is shown.

Declared In

Instabug.h

+ setPostInvocationBlock:

Sets a block of code to be executed right after the SDK’s UI is dismissed. (Deprecated: Starting from v6.0, use setPostInvocationHandler: instead.)

+ (void)setPostInvocationBlock:(void ( ^ ) ( IBGIssueState issueState , IBGFeedbackType feedbackType ))postInvocationBlock

Parameters

postInvocationBlock

A block of code that gets executed after the SDK’s UI is dismissed.

The block has the following parameters:

  • issueState: The state of the issue after the SDK has been dismissed. Indicates whether the issues has been submitted, cancelled, or still in progress.
  • feedbackType: Type of feedback that has been sent. Will be set to IBGFeedbackTypeBug in case the SDK has been dismissed without selecting a report type, so you might need to check issueState before feedbackType.

Discussion

This block is executed on the UI thread. Could be used for performing any UI changes after the SDK’s UI is dismissed.

Declared In

Instabug.h

+ setPostInvocationHandler:

Sets a block of code to be executed right after the SDK’s UI is dismissed.

+ (void)setPostInvocationHandler:(void ( ^ ) ( IBGDismissType dismissType , IBGReportType reportType ))postInvocationHandler

Parameters

postInvocationHandler

A block of code that gets executed after the SDK’s UI is dismissed.

The block has the following parameters:

  • dismissType: How the SDK was dismissed.
  • reportType: Type of report that has been sent. Will be set to IBGReportTypeBug in case the SDK has been dismissed without selecting a report type, so you might need to check dismissType before reportType.

Discussion

This block is executed on the UI thread. Could be used for performing any UI changes after the SDK’s UI is dismissed.

Declared In

Instabug.h

+ setDidSelectPromptOptionHandler:

Sets a block of code to be executed when a prompt option is selected

+ (void)setDidSelectPromptOptionHandler:(void ( ^ ) ( IBGPromptOption promptOption ))didSelectPromptOptionHandler

Parameters

didSelectPromptOptionHandler

A block of code that gets executed when a prompt option is selected.

The block has the following parameters: - prompOption: The option selected in prompt.

Declared In

Instabug.h

+ showIntroMessage

Present a view that educates the user on how to invoke the SDK with the currently set invocation event.

+ (void)showIntroMessage

Discussion

Does nothing if invocation event is set to anything other than IBGInvocationEventShake or IBGInvocationEventScreenshot.

Declared In

Instabug.h

+ setWillTakeScreenshot:

Enables/disables the attachment of an initial screenshot when reporting a bug/improvement. (Deprecated: Starting from v6.0, use setAttachmentTypesEnabledScreenShot:extraScreenShot:galleryImage:voiceNote:screenRecording: instead.)

+ (void)setWillTakeScreenshot:(BOOL)willTakeScreenshot

Parameters

willTakeScreenshot

A boolean to set whether attachment of an initial screenshot is enabled or disabled.

Declared In

Instabug.h

+ identifyUserWithEmail:name:

Sets the user email and name for all sent reports.

+ (void)identifyUserWithEmail:(NSString *)email name:(nullable NSString *)name

Parameters

email

Email address to be set as the user’s email.

name

Name of the user to be set.

Declared In

Instabug.h

+ logOut

Resets the value of the user’s email and name, previously set using + [[Instabug identifyUserWithEmail:name:]](#//api/name/identifyUserWithEmail:name:).

+ (void)logOut

Discussion

This method also resets all chats currently on the device and removes any set user attributes.

Declared In

Instabug.h

+ setUserEmail:

Sets the default value of the user’s email and hides the email field from the reporting UI.

+ (void)setUserEmail:(NSString *)userEmail

Parameters

userEmail

An email address to be set as the user’s email.

Discussion

Defaults to an empty string.

Declared In

Instabug.h

+ setUserName:

Sets the default value of the user’s name to be included with all reports.

+ (void)setUserName:(NSString *)userName

Parameters

userName

Name of the user to be set.

Discussion

Defaults to an empty string.

Declared In

Instabug.h

+ setShowEmailField:

Shows/Hides email field.

+ (void)setShowEmailField:(BOOL)isShowingEmailField

Parameters

isShowingEmailField

YES to show the email field, NO to hide it.

Discussion

Defaults to show email field.

Declared In

Instabug.h

+ setWillShowScreenshotView:

Enables/disables screenshot view when reporting a bug/improvement. (Deprecated: Starting from v6.0, use setWillSkipScreenshotAnnotation: instead.)

+ (void)setWillShowScreenshotView:(BOOL)willShowScreenshotView

Parameters

willShowScreenshotView

A boolean to set whether screenshot view is shown or not. Passing YES will show screenshot view for both feedback and bug reporting, while passing NO will disable it for both.

Discussion

By default, screenshot view is shown when reporting a bug, but not when sending feedback.

Declared In

Instabug.h

+ setWillSkipScreenshotAnnotation:

Enables/disables screenshot view when reporting a bug/improvement.

+ (void)setWillSkipScreenshotAnnotation:(BOOL)willSkipScreenShot

Parameters

willSkipScreenShot

A boolean to set whether screenshot view is shown or not. Passing YES will show screenshot view for both feedback and bug reporting, while passing NO will disable it for both.

Discussion

By default, screenshot view is shown when reporting a bug, but not when sending feedback.

Declared In

Instabug.h

+ getUnreadMessagesCount

Returns the number of unread messages the user currently has.

+ (NSInteger)getUnreadMessagesCount

Return Value

Notifications count, or -1 incase the SDK has not been initialized.

Discussion

Use this method to get the number of unread messages the user has, then possibly notify them about it with your own UI.

Declared In

Instabug.h

SDK Settings

+ setInvocationEvent:

Sets the event that invoke the feedback form.

+ (void)setInvocationEvent:(IBGInvocationEvent)invocationEvent

Parameters

invocationEvent

Event that invokes the feedback form.

Discussion

Default is set by startWithToken:invocationEvent:.

Declared In

Instabug.h

+ setDefaultInvocationMode:

Sets the default SDK invocation mode. (Deprecated: Starting from v6.0, use setPromptOptionsEnabledWithBug:feedback:chat: instead.)

+ (void)setDefaultInvocationMode:(IBGInvocationMode)invocationMode

Parameters

invocationMode

A mode that’s used to invoke the SDK.

Discussion

Defaults to IBGInvocationModeNA.

Declared In

Instabug.h

+ setPushNotificationsEnabled:

Enables/disables the use of push notifications in the SDK.

+ (void)setPushNotificationsEnabled:(BOOL)isPushNotificationsEnabled

Parameters

isPushNotificationsEnabled

A boolean to indicate whether push notifications are enabled or disabled.

Discussion

In order to enable push notifications, implement [UIApplicationDelegate application:didRegisterForRemoteNotificationsWithDeviceToken:] and either [UIApplicationDelegate application:didReceiveRemoteNotification] or [UIApplicationDelegate application:didReceiveRemoteNotification:fetchCompletionHandler:].

Defaults to YES.

Declared In

Instabug.h

+ setEmailFieldRequired:

Sets whether users are required to enter an email address or not when sending reports.

+ (void)setEmailFieldRequired:(BOOL)isEmailFieldRequired

Parameters

isEmailFieldRequired

A boolean to indicate whether email field is required or not.

Discussion

Defaults to YES.

Declared In

Instabug.h

+ setCommentFieldRequired:

Sets whether users are required to enter a comment or not when sending reports.

+ (void)setCommentFieldRequired:(BOOL)isCommentFieldRequired

Parameters

isCommentFieldRequired

A boolean to indicate whether comment field is required or not.

Discussion

Defaults to NO.

Declared In

Instabug.h

+ setShakingThresholdForiPhone:foriPad:

Sets the threshold value of the shake gesture for iPhone/iPod Touch and iPad.

+ (void)setShakingThresholdForiPhone:(double)iPhoneShakingThreshold foriPad:(double)iPadShakingThreshold

Parameters

iPhoneShakingThreshold

Threshold for iPhone.

iPadShakingThreshold

Threshold for iPad.

Discussion

Default for iPhone is 2.5. Default for iPad is 0.6.

Declared In

Instabug.h

+ setFloatingButtonEdge:withTopOffset:

Sets the default edge and offset from the top at which the floating button will be shown. Different orientations are already handled.

+ (void)setFloatingButtonEdge:(CGRectEdge)floatingButtonEdge withTopOffset:(double)floatingButtonOffsetFromTop

Parameters

floatingButtonEdge

CGRectMaxXEdge to show on the right, or CGRectMinXEdge to show on the left.

floatingButtonOffsetFromTop

Top offset for floating button.

Discussion

Default for floatingButtonEdge is CGRectMaxXEdge. Default for floatingButtonOffsetFromTop is 50

Declared In

Instabug.h

+ setVideoRecordingFloatingButtonPosition:

Sets the default position at which the Instabug screen recording button will be shown. Different orientations are already handled.

+ (void)setVideoRecordingFloatingButtonPosition:(IBGPosition)position

Parameters

position

topLeft to show on the top left of screen , or bottomRight to show on the bottom right of scrren.

Discussion

Default for position is bottomRight.

Declared In

Instabug.h

+ setLocale:

Sets the SDK’s locale.

+ (void)setLocale:(IBGLocale)locale

Parameters

locale

A locale to set the SDK to.

Discussion

Use to change the SDK’s UI to different language. Defaults to the device’s current locale.

See Also

Declared In

Instabug.h

+ setIntroMessageEnabled:

Sets whether the intro message that gets shown on launching the app is enabled or not.

+ (void)setIntroMessageEnabled:(BOOL)isIntroMessageEnabled

Parameters

isIntroMessageEnabled

A boolean to indicate whether the intro message is enabled or not.

Discussion

Defaults to YES.

Declared In

Instabug.h

+ setPostSendingDialogEnabled:

Sets whether to show a “Thank You” dialog after a bug report is sent or not.

+ (void)setPostSendingDialogEnabled:(BOOL)isPostSendingDialogEnabled

Parameters

isPostSendingDialogEnabled

A boolean to indicate whether the dialog is enabled or not.

Discussion

Defaults to YES.

Declared In

Instabug.h

+ setColorTheme:

Sets the color theme of the SDK’s whole UI.

+ (void)setColorTheme:(IBGColorTheme)colorTheme

Parameters

colorTheme

An IBGColorTheme to set the SDK’s UI to.

See Also

Declared In

Instabug.h

+ setPrimaryColor:

Sets the primary color of the SDK’s UI.

+ (void)setPrimaryColor:(UIColor *)color

Parameters

color

A color to set the UI elements of the SDK to.

Discussion

Sets the color of UI elements indicating interactivity or call to action.

Declared In

Instabug.h

+ setScreenshotCapturingBlock:

Sets a block of code that is used to capture a screenshot. (Deprecated: Starting from v6.0, use setScreenshotCapturingHandler: instead.)

+ (void)setScreenshotCapturingBlock:(UIImage *( ^ ) ( void ))screenshotCapturingBlock

Parameters

screenshotCapturingBlock

A block of code that’s going to be used to capture screenshots.

Discussion

Should only be used if your app uses OpenGL.

Declared In

Instabug.h

+ setScreenshotCapturingHandler:

Sets a block of code that is used to capture a screenshot.

+ (void)setScreenshotCapturingHandler:(UIImage *( ^ ) ( void ))screenshotCapturingHandler

Parameters

screenshotCapturingHandler

A block of code that’s going to be used to capture screenshots.

Discussion

Should only be used if your app uses OpenGL.

Declared In

Instabug.h

+ addTags:

Appends a set of tags to previously added tags of reported feedback, bug or crash. (Deprecated: Starting from v6.0, use appendTags: instead.)

+ (void)addTags:(NSString *)tag, ...

Parameters

tag

A set of tags.

...

Declared In

Instabug.h

+ addTags:withArguments:

Appends a set of tags to previously added tags of reported feedback, bug or crash. (Deprecated: Starting from v6.0, use appendTags: instead.)

+ (void)addTags:(NSString *)tag withArguments:(va_list)arguments

Parameters

tag

tag

arguments

arguments

Discussion

This method is identical to + [Instabug addtags:], but is meant to be used from Swift.

To use this method from Swift, you will need to add the following code to the class that’s going to call it.

func addTags(str: String, _ arguments: CVarArgType…) -> Void { return withVaList(arguments) { Instabug.addTags(str, withArguments :$0) } } And then call addTags(“tag 1”, “tag 2”, “tag 3”).

Declared In

Instabug.h

+ appendTags:

Appends a set of tags to previously added tags of reported feedback, bug or crash.

+ (void)appendTags:(NSArray<NSString*> *)tags

Parameters

tags

An array of tags to append to current tags.

Declared In

Instabug.h

+ resetTags

Manually removes all tags of reported feedback, bug or crash.

+ (void)resetTags

Declared In

Instabug.h

+ getTags

Gets all tags of reported feedback, bug or crash.

+ (NSArray *)getTags

Return Value

An array of tags.

Declared In

Instabug.h

+ setString:toKey:

Overrides any of the strings shown in the SDK with custom ones. (Deprecated: Use setValue:forStringWithKey: instead.)

+ (void)setString:(NSString *)value toKey:(IBGString)key

Parameters

value

String value to override the default one.

key

Key of string to override.

Discussion

Allows you to customize any of the strings shown to users in the SDK.

See Also

Declared In

Instabug.h

+ setValue:forStringWithKey:

Overrides any of the strings shown in the SDK with custom ones.

+ (void)setValue:(NSString *)value forStringWithKey:(NSString *)key

Parameters

value

String value to override the default one.

key

Key of string to override. Use predefined keys like IBGShakeStartAlertTextStringName, IBGEmailFieldPlaceholderStringName, etc.

Discussion

Allows you to customize any of the strings shown to users in the SDK.

Declared In

Instabug.h

+ setAttachmentTypesEnabledScreenShot:extraScreenShot:galleryImage:voiceNote:screenRecording:

Sets whether attachments in bug reporting and in-app messaging are enabled or not.

+ (void)setAttachmentTypesEnabledScreenShot:(BOOL)screenShot extraScreenShot:(BOOL)extraScreenShot galleryImage:(BOOL)galleryImage voiceNote:(BOOL)voiceNote screenRecording:(BOOL)screenRecording

Parameters

screenShot

A boolean to enable or disable screenshot attachments.

extraScreenShot

A boolean to enable or disable extra screenshot attachments.

galleryImage

A boolean to enable or disable gallery image attachments. In iOS 10+, NSPhotoLibraryUsageDescription should be set in info.plist to enable gallery image attachments.

voiceNote

A boolean to enable or disable voice note attachments. In iOS 10+, NSMicrophoneUsageDescription should be set in info.plist to enable voiceNote attachments.

screenRecording

A boolean to enable or disable screen recording attachments.

Declared In

Instabug.h

+ setEnabledAttachmentTypes:

Sets whether attachments in bug reporting and in-app messaging are enabled.

+ (void)setEnabledAttachmentTypes:(IBGAttachmentType)attachmentTypes

Parameters

attachmentTypes

A NS_OPTIONS to add enabled attachments type.

Declared In

Instabug.h

+ setChatNotificationEnabled:

Enables/disables showing in-app notifications when the user receives a new message.

+ (void)setChatNotificationEnabled:(BOOL)chatNotificationEnabled

Parameters

chatNotificationEnabled

A boolean to set whether notifications are enabled or disabled.

Declared In

Instabug.h

+ setOnNewMessageHandler:

Sets a block of code that gets executed when a new message is received.

+ (void)setOnNewMessageHandler:(void ( ^ ) ( void ))onNewMessageHandler

Parameters

onNewMessageHandler

A block of code that gets executed when a new message is received.

Declared In

Instabug.h

+ setPromptOptionsEnabledWithBug:feedback:chat:

Enables/disables prompt options when SDK is invoked.

+ (void)setPromptOptionsEnabledWithBug:(BOOL)bugReportEnabled feedback:(BOOL)feedbackEnabled chat:(BOOL)chatEnabled

Parameters

bugReportEnabled

A boolean to indicate whether bug reports are enabled or disabled.

feedbackEnabled

A boolean to indicate whether feedback is enabled or disabled.

chatEnabled

A boolean to indicate whether chat is enabled or disabled.

Discussion

When only a single option is enabled, it become the default invocation mode. If all options are disabled, bug reporting becomes the default invocation mode.

By default, all three options are enabled.

Declared In

Instabug.h

+ setReportCategoriesWithTitles:iconNames:

Sets an array of report categories to be shown for users to select from before reporting a bug or sending feedback.

+ (void)setReportCategoriesWithTitles:(NSArray<NSString*> *)titles iconNames:(nullable NSArray<NSString*> *)names

Parameters

titles

Array of titles to be shown in the list.

names

Array of names of icons to be shown along with titles. Use the same names you would use with + [UIImage imageNamed:].

Discussion

Use this method to give users a list of choices of categories their bug report or feedback might be related to. Selected category will be shown as a tag on your dashboard.

Declared In

Instabug.h

+ addExtraReportFieldWithTitle:required:

Sets an array of report categories to be shown for users to select from before reporting a bug or sending feedback.

+ (void)addExtraReportFieldWithTitle:(NSString *)title required:(BOOL)required

Parameters

title

extra field key.

required

determine whether this field is required or not.

Discussion

Use this method to give users a form after reporting a bug to be filled and sent inside description.

Declared In

Instabug.h

+ removeExtraReportFields

Remove all extra fields.

+ (void)removeExtraReportFields

Discussion

Use this method to remove all added extra fields.

Declared In

Instabug.h

+ setUserAttribute:withKey:

Set custom user attributes that are going to be sent with each feedback, bug or crash.

+ (void)setUserAttribute:(NSString *)value withKey:(NSString *)key

Parameters

value

User attribute value.

key

User attribute key.

Declared In

Instabug.h

+ userAttributeForKey:

Returns the user attribute associated with a given key.

+ (nullable NSString *)userAttributeForKey:(NSString *)key

Parameters

key

The key for which to return the corresponding value..

Return Value

The value associated with aKey, or nil if no value is associated with aKey.

Declared In

Instabug.h

+ removeUserAttributeForKey:

Removes a given key and its associated value from user attributes.

Does nothing if aKey does not exist.

+ (void)removeUserAttributeForKey:(NSString *)key

Parameters

key

The key to remove.

Declared In

Instabug.h

+ userAttributes

Returns all user attributes.

+ (nullable NSDictionary *)userAttributes

Return Value

A new dictionary containing all the currently set user attributes, or an empty dictionary if no user attributes have been set.

Declared In

Instabug.h

+ setViewHierarchyEnabled:

Enables/disables inspect view hierarchy when reporting a bug/feedback.

+ (void)setViewHierarchyEnabled:(BOOL)viewHierarchyEnabled

Parameters

viewHierarchyEnabled

A boolean to set whether view hierarchy are enabled or disabled.

Declared In

Instabug.h

SDK Reporting

+ reportException:

Report an exception manually.

+ (void)reportException:(NSException *)exception

Parameters

exception

Exception to be reported.

Declared In

Instabug.h

+ reportError:

Report an error manually.

+ (void)reportError:(NSError *)error

Parameters

error

error to be reported.

Declared In

Instabug.h

In-App Conversations

+ invokeConversations

Invokes the SDK and shows the conversations view. (Deprecated: Starting from v6.0, use invokeWithInvocationMode: instead.)

+ (void)invokeConversations

Declared In

Instabug.h

Push Notifications

+ isInstabugNotification:

Checks if a notification is from Instabug.

+ (BOOL)isInstabugNotification:(NSDictionary *)notification

Parameters

notification

userInfo dictionary received in [UIApplicationDelegate application:didReceiveRemoteNotification:].

Return Value

YES if notification is from Instabug.

Discussion

If you are using push notifications, use this method to check whether an incoming notification is from Instabug or not. If this method returns YES, you should call didReceiveRemoteNotification: to let the Instabug handle the notification. Otherwise, handle the notification on your own.

Declared In

Instabug.h

+ didRegisterForRemoteNotificationsWithDeviceToken:

Use this method to set Apple Push Notification token to enable receiving Instabug push notifications.

+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

Parameters

deviceToken

Device token received in [UIApplicationDelegate didRegisterForRemoteNotificationsWithDeviceToken:]

Discussion

You should call this method after receiving token in [UIApplicationDelegate didRegisterForRemoteNotificationsWithDeviceToken:] and pass received token.

Declared In

Instabug.h

+ didReceiveRemoteNotification:

Call this method and pass the notification’s userInfo dictionary to allow Instabug to handle its remote notifications.

+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfo

Parameters

userInfo

userInfo dictionary from [UIApplicationDelegate application:didReceiveRemoteNotification:] or [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey] from [UIApplicationDelegate application:didFinishLaunchingWithOptions:].

Discussion

Instabug will check if notification is from Instabug’s servers and only handle it if it is. You should call this method in [UIApplicationDelegate application:didReceiveRemoteNotification:] and pass received userInfo dictionary, or [UIApplicationDelegate application:didFinishLaunchingWithOptions:] and pass [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey].

Declared In

Instabug.h

+ logUserEventWithName:

Logs a user event that happens through the lifecycle of the application.

+ (void)logUserEventWithName:(NSString *)name

Parameters

name

Event name.

Discussion

Logged user events are going to be sent with each report, as well as at the end of a session.

Declared In

Instabug.h

+ logUserEventWithName:params:

Logs a user event that happens through the lifecycle of the application.

+ (void)logUserEventWithName:(NSString *)name params:(nullable NSDictionary *)params

Parameters

name

Event name.

params

An optional dictionary or parameters to be associated with the event. Make sure it’s JSON serializable.

Discussion

Logged user events are going to be sent with each report, as well as at the end of a session.

Declared In

Instabug.h

+ IBGLog:

Adds custom logs that will be sent with each report. Logs are added with the debug log level.

+ (void)IBGLog:(NSString *)log

Parameters

log

Message to be logged.

Declared In

Instabug.h

+ logVerbose:

Adds custom logs with the verbose log level. Logs will be sent with each report.

+ (void)logVerbose:(NSString *)log

Parameters

log

Message to be logged.

Declared In

Instabug.h

+ logDebug:

Adds custom logs with the debug log level. Logs will be sent with each report.

+ (void)logDebug:(NSString *)log

Parameters

log

Message to be logged.

Declared In

Instabug.h

+ logInfo:

Adds custom logs with the info log level. Logs will be sent with each report.

+ (void)logInfo:(NSString *)log

Parameters

log

Message to be logged.

Declared In

Instabug.h

+ logWarn:

Adds custom logs with the warn log level. Logs will be sent with each report.

+ (void)logWarn:(NSString *)log

Parameters

log

Message to be logged.

Declared In

Instabug.h

+ logError:

Adds custom logs with the error log level. Logs will be sent with each report.

+ (void)logError:(NSString *)log

Parameters

log

Message to be logged.

Declared In

Instabug.h

+ setIBGLogPrintsToConsole:

Sets whether IBGLog should also print to Xcode’s console log or not.

+ (void)setIBGLogPrintsToConsole:(BOOL)enabled

Parameters

enabled

A boolean to set whether printing to Xcode’s console is enabled or not.

Discussion

Defaults to YES.

Declared In

Instabug.h

+ clearAllLogs

Clear all Logs.

+ (void)clearAllLogs

Discussion

Clear all Instabug logs, console logs, network logs and user steps.

Declared In

Instabug.h

+ setNetworkLoggingEnabled:

Sets whether to log network requests or not.

+ (void)setNetworkLoggingEnabled:(BOOL)isNetworkLoggingEnabled

Parameters

isNetworkLoggingEnabled

A boolean to set network logging to be enabled to disabled.

Discussion

When enabled, Instabug will automtically log all network requests and responses. Logs are attached to each report being sent and are available on your Instabug dashboard.

Networking logging is enabled by default if it’s available in your current plan.

Declared In

Instabug.h

+ setNetworkLoggingFilterPredicate:

Specify an NSPredicate to be used to omit certain requests from being logged. (Deprecated: Use setNetworkLoggingRequestFilterPredicate:responseFilterPredicate: instead.)

+ (void)setNetworkLoggingFilterPredicate:(NSPredicate *)filterPredicate

Parameters

filterPredicate

An NSPredicate to match against an NSURLRequest. Matching requests will be omitted.

Discussion

Predicate will be matched against an NSURLRequest. This can be used to filter out requests to a specific domain for example.

Declared In

Instabug.h

+ setNetworkLoggingRequestFilterPredicate:responseFilterPredicate:

Specify NSPredicates to be used to omit certain network requests from being logged based on their request or response objects.

+ (void)setNetworkLoggingRequestFilterPredicate:(nullable NSPredicate *)requestFilterPredicate responseFilterPredicate:(nullable NSPredicate *)responseFilterPredicate

Parameters

requestFilterPredicate

An NSPredicate to match against an NSURLRequest. Matching requests will be omitted.

responseFilterPredicate

An NSPredicate to match against an NSHTTPURLResponse. Matching responses will be omitted.

Discussion

requestFilterPredicate will be matched against an NSURLRequest. It can be used to filter out requests to a specific domain for example.

responseFilterPredicate will be matched against an NSHTTPURLResponse. It can be used to filter out responses that match specific status codes.

If both predicates are specified, requestFilterPredicate is evaluated first, if it matches, the request is omitted from logging without evaluating responseFilterPredicate.

Declared In

Instabug.h

+ enableLoggingForURLSessionConfiguration:

Enable logging for network requests and responses on a custom NSURLSessionConfiguration.

+ (void)enableLoggingForURLSessionConfiguration:(NSURLSessionConfiguration *)URLSessionConfiguration

Parameters

URLSessionConfiguration

The NSURLSessionConfiguration of your custom NSURLSession.

Discussion

Logging for network requests and responses may not work if you’re using a custom NSURLSession object. If this is the case, call this method passing in your custom NSURLSessions’s configuration to enable logging for it.

Declared In

Instabug.h

+ logHTTPBody:forRequest:

Set HTTP body of a POST request to be included in network logs. (Deprecated: Now body of a POST request is captured automatcailly you don’t have to log it manually)

+ (void)logHTTPBody:(NSData *)body forRequest:(NSMutableURLRequest *)request

Parameters

body

Body data of a POST request.

request

The POST request that is being sent.

Discussion

Due to a bug in Foundation, it’s not possible to retrieve the body of POST requests automatically. Use this method to include the body of your POST requests in network logs.

If you’d like to exclude or obfuscate user sensitive data in the request body, this is also the place to do it.

Declared In

Instabug.h

+ setNetworkLoggingURLObfuscationHandler:

Use to obfuscate a URL that’s going to be included in network logs.

+ (void)setNetworkLoggingURLObfuscationHandler:(nonnull NSURL *( ^ ) ( NSURL *_Nonnull url ))obfuscationHandler

Parameters

obfuscationHandler

A block that obfuscates the passed URL and returns it.

Discussion

Use this method if you make requests that include user sensitive data in the URL (like authentication tokens for example), and you’d like to hide those from your network logs.

The provided block will be called for every request. You should do whatever processing you need to do on the URL inside that block, then return a URL to be included in network logs.

Declared In

Instabug.h

+ setNetworkLogRequestObfuscationHandler:

Use to obfuscate a request that’s going to be included in network logs.

+ (void)setNetworkLogRequestObfuscationHandler:(nonnull NSURLRequest *( ^ ) ( NSURLRequest *_Nonnull request ))obfuscationHandler

Parameters

obfuscationHandler

A block that takes a request and returns a new modified one to be logged..

Discussion

Use this method if you want to make any modifications to requests before it is added to the network log. This won’t be applied to already filtered requests

Note that thsese changes doesn’t affect the actual request.

The provided block will be called for every request. You should do whatever processing you need to do on the request inside that block, then return a request to be included in network logs.

This method usage overrides modifications made by setNetworkLoggingURLObfuscationHandler:.

Declared In

Instabug.h

+ setNetworkLogResponseObfuscationHandler:

Use to obfuscate a request’s response that’s going to be included in network logs.

+ (void)setNetworkLogResponseObfuscationHandler:(void ( ^ ) ( NSData *_Nullable responseData , NSURLResponse *_Nonnull response , NetworkObfuscationCompletionBlock returnBlock ))obfuscationHandler

Parameters

obfuscationHandler

A block that takes the original response, its data and a return block as parameters. The return block should be called with the modified data and response.

Discussion

Use this method if you want to make any modifications to a request’s respone and its data before it’s added to network logs.

The provided block will be called for every response. You should do whatever processing you need to do on the response and data inside that block, then return response and data to be included in network logs. Changes you make to the response and its data only affect network logs, not the actual response.

Declared In

Instabug.h

+ setProgressHandlerForRequestURL:progressHandler:

Use to get callbacks about progress of sending body content of a particular request when networking logging is enabled.

+ (void)setProgressHandlerForRequestURL:(nonnull NSURL *)URL progressHandler:(nonnull void ( ^ ) ( NSURLSessionTask *task , int64_t bytesSent , int64_t totalBytesSent , int64_t totalBytesExpectedToSend ))requestProgressHandler

Parameters

URL

URL which will be attached with requestProgressHandler.

requestProgressHandler

A block that will be called for the requestURL when SDK intercept that request.

Discussion

The provided block will get periodical callbacks about the progress of sending the body content of a request.

Declared In

Instabug.h

+ setCanAuthenticateAgainstProtectionSpaceHandler:

Used to ask whether your app is prepared to handle a particular authentication challenge. Can be called on any thread.

+ (void)setCanAuthenticateAgainstProtectionSpaceHandler:(BOOL ( ^ ) ( NSURLProtectionSpace *protectionSpace ))protectionSpaceHandler

Parameters

protectionSpaceHandler

A block that takes the protection space for the authentication challenge and should return true or false.

Discussion

Set this block if your app implements SSL pinning and you have network logging enabled.

Declared In

Instabug.h

+ setDidReceiveAuthenticationChallengeHandler:

Used to process an authentication challenge and return an NSURLCredential object.

+ (void)setDidReceiveAuthenticationChallengeHandler:(NSURLCredential *( ^ ) ( NSURLAuthenticationChallenge *challenge ))reciveChallengeHandler

Parameters

reciveChallengeHandler

A block that takes the authentication challenge and returns NSURLCredential.

Discussion

Set this block if your app implements SSL pinning and you have network logging enabled.

Declared In

Instabug.h

+ setAutoShowingSurveysEnabled:

Sets whether auto surveys showing are enabled or not.

+ (void)setAutoShowingSurveysEnabled:(BOOL)autoShowingSurveysEnabled

Parameters

autoShowingSurveysEnabled

A boolean to indicate whether the surveys auto showing are enabled or not.

Discussion

If you disable surveys auto showing on the SDK but still have active surveys on your Instabug dashboard, those surveys are still going to be sent to the device, but are not going to be shown automatically.

To manually display any available surveys, call + [[Instabug showSurveyIfAvailable]](#//api/name/showSurveyIfAvailable).

Defaults to YES.

Declared In

Instabug.h

+ setSurveysEnabled:

Sets whether surveys are enabled or not.

+ (void)setSurveysEnabled:(BOOL)surveysEnabled

Parameters

surveysEnabled

A boolean to indicate whether the survey feature is enabled or not.

Discussion

if you disable surveys feature. all survey’s methods won’t perform untile this flage is enabled again.

Defaults to YES.

Declared In

Instabug.h

+ showSurveyIfAvailable

Shows one of the surveys that were not shown before, that also have conditions that match the current device/user.

+ (void)showSurveyIfAvailable

Discussion

Does nothing if there are no available surveys.

Declared In

Instabug.h

+ hasAvailableSurveys

Returns true if there are any surveys that match the current device/user.

+ (BOOL)hasAvailableSurveys

Declared In

Instabug.h

+ setWillShowSurveyHandler:

Sets a block of code to be executed just before the survey’s UI is presented.

+ (void)setWillShowSurveyHandler:(void ( ^ ) ( void ))willShowSurveyHandler

Parameters

willShowSurveyHandler

A block of code that gets executed before presenting the survey’s UI.

Discussion

This block is executed on the UI thread. Could be used for performing any UI changes before the survey’s UI is shown.

Declared In

Instabug.h

+ setDidDismissSurveyHandler:

Sets a block of code to be executed right after the survey’s UI is dismissed.

+ (void)setDidDismissSurveyHandler:(void ( ^ ) ( void ))didShowSurveyHandler

Parameters

didShowSurveyHandler

A block of code that gets executed after the survey’s UI is dismissed.

Discussion

This block is executed on the UI thread. Could be used for performing any UI changes after the survey’s UI is dismissed.

Declared In

Instabug.h

+ showSurveyWithToken:

Shows Survey with a specific token.

+ (void)showSurveyWithToken:(NSString *)surveyToken

Parameters

surveyToken

A String with a survey token.

Discussion

Does nothing if there are no available surveys with that specific token. Answered and canceled surveys won’t show up again.

Declared In

Instabug.h

+ hasRespondedToSurveyWithToken:

Returns true if the survey with a specific token was answered before .

+ (BOOL)hasRespondedToSurveyWithToken:(NSString *)surveyToken

Parameters

surveyToken

A String with a survey token.

Discussion

Will return false if the token does not exist or if the survey was not answered before.

Declared In

Instabug.h

+ setSDKDebugLogsLevel:

Sets the verbosity level of logs used to debug the Instabug SDK itself.

+ (void)setSDKDebugLogsLevel:(IBGSDKDebugLogsLevel)level

Parameters

level

Logs verbosity level.

Discussion

This API sets the verbosity level of logs used to debug The SDK. The defualt value in debug mode is IBGSDKDebugLogsLevelVerbose and in production is IBGSDKDebugLogsLevelError.

Declared In

Instabug.h