This section covers how to change the event done by the user to invoke the SDK, as well as the default feature to be used once the SDK is invoked.

By default, Instabug is invoked when the device is shaken. This can be customized to several other out-of-the-box modes to show the SDK. You can also show the SDK manually from a custom gesture or a button you add to your app.

Invocation Events

You can set the SDK to be shown using one of the following modes:

  • Shake device
  • Take a screenshot (using Home and lock buttons)
  • Tap on a floating button shown above your app's UI
  • Pan from the right edge of the screen
  • Do a 2-finger swipe from right to left
  • None (do it manually)

Initializing Instabug in your application could be done using one or multiple invocation events. To customize the invocation events, pass of the values of the IBGBugReporting enum when starting the SDK.

[Instabug startWithToken:@"YOUR-TOKEN-HERE" invocationEvents: IBGInvocationEventShake | IBGInvocationEventScreenshot]
Instabug.start(withToken: "YOUR-TOKEN-HERE", invocationEvents: [.shake, .screenshot])

You can find the possible invocation events below. The None event can be used in case you want to prevent the SDK from being invoked by the normal way and invoke it later on manually whenever you need or under certain conditions. In case you are using the floating button, you can set its default position as explained here.


Changing the Invocation Event

You can change the invocation event to any of the supported events at runtime‚Äč as shown below.

[IBGBugReporting setInvocationEvents:IBGInvocationEventShake | IBGInvocationEventScreenshot];
BugReporting.setInvocationEvents([.shake, .screenshot])

Shaking Threshold

If you are using the shaking gesture as your invocation event you can set how sensitive your device is to the shaking. The values in the following example are the default ones. The higher the value the less sensitive the device will be to shaking.

IBGBugReporting.shakingThresholdForiPhone = 3.0;
IBGBugReporting.shakingThresholdForiPad = 1.0;
IBGBugReporting.shakingThresholdForiPhone = 3.0;
IBGBugReporting.shakingThresholdForiPad = 1.0;

Manual Invocation

If you want to invoke the SDK manually, use the invoke method.

[IBGBugReporting invoke];

Alternatively, instead of showing the menu that lets the users choose what they want to do as shown in the image below, you could show the SDK with a specific feature. In this case, the "How can we help you?" popup shown below will not appear.

[IBGBugReporting invokeWithMode:IBGInvocationModeNewBug options:0];
// You can also specify invocation options
[IBGBugReporting invokeWithMode:IBGInvocationModeNewBug options:IBGBugReportingInvocationOptionEmailFieldHidden];
[IBGBugReporting invokeWithMode:IBGInvocationModeNewBug options:IBGBugReportingInvocationOptionEmailFieldHidden | IBGBugReportingInvocationOptionCommentFieldRequired];
BugReporting.invoke(with: .newBug, options: [])

// You can also specify invocation options
BugReporting.invoke(with: .newBug, options: .emailFieldHidden)
BugReporting.invoke(with: .newBug, options: [.emailFieldHidden, .commentFieldRequired])
Invocation View

Invocation View

Here are the possible invocation modes.