Welcome to Instabug's Documentation!
Here you'll find a comprehensive technical guide
to help you start working with the Instabug SDK efficiently.

Get Started

SDK 8.0 Migration Guide

This page covers the migration steps from previous versions of the SDK to
version 8.0+.

Version 8.0 of the Instabug iOS SDK contains various changes to our APIs. This document contains detailed instructions on how to migrate from previous versions of the SDK to version 8.0+.

To make our APIs more intuitive, more organized and easier to use, we renamed some of them, and restructured them into different classes.

Summary of Changes

In addition to the Instabug class, Instabug now has the following additional classes:

  • IBGBugReporting
  • IBGSurveys
  • IBGFeatureRequests
  • IBGLog

When used for Android, the classes above drop the IBG prefix, to become:

  • BugReporting
  • Surveys
  • FeatureRequests

Each class contains methods and properties of a single product or feature.

🚧

API Deprecations

For APIs that have been moved to other classes or renamed, the old versions in the Instabug class has been marked as deprecated. While those APIs are still functional, they will be completely removed from a future release of the SDK, so please make sure to migrate all Instabug usage to the new APIs at the nearest opportunity.

Deprecated, Renamed and Moved Methods

StartWithToken

Previous Usage

Instabug.StartWithToken("YOUR_APP_TOKEN", IBGInvocationEvent.FloatingButton);
new Instabug.Builder(this, "YOUR_APP_TOKEN")        .SetInvocationEvents(InstabugInvocationEvent.Shake).Build();

New Usage

Instabug.StartWithToken("YOUR_APP_TOKEN", IBGInvocationEvent.Shake | IBGInvocationEvent.Screenshot);
new Instabug.Builder(this, "TOKEN").SetInvocationEvents(InstabugInvocationEvent.FloatingButton, InstabugInvocationEvent.Shake).Build();

Notes

Instead of just a single event, You can now set multiple active invocation events.


Invoke

Previous Usage

Instabug.Invoke();
Instabug.Invoke();

New Usage

IBGBugReporting.Invoke();
BugReporting.Invoke()

InvokeWithInvocationMode

Previous Usage

Instabug.InvokeWithInvocationMode(IBGInvocationMode.NewBug);
Instabug.Invoke(InstabugInvocationMode.NewBug);

New Usage

IBGBugReporting.InvokeWithInvocationMode(IBGInvocationMode.NewBug, 0);

// You can also specify invocation options
IBGBugReporting.InvokeWithInvocationMode(IBGInvocationMode.NewBug, IBGBugReportingInvocationOption.EmailFieldHidden);
IBGBugReporting.InvokeWithInvocationMode(IBGInvocationMode.NewBug, IBGBugReportingInvocationOption.EmailFieldHidden | IBGBugReportingInvocationOption.CommentFieldRequired);
BugReporting.Invoke(InvocationMode.NewBug);

// You can also specify invocation options
BugReporting.Invoke(InvocationMode.NewBug, InvocationOption.EmailFieldHidden);
BugReporting.Invoke(InvocationMode.NewBug, InvocationOption.EmailFieldHidden, InvocationOption.CommentFieldRequired);

Notes

See IBGBugReportingInvocationOption for all invocation options.


SetPreInvocationHandler:

Previous Usage

var beforeShowingSDKAction = new System.Action(() => {
  System.Console.WriteLine("SDK will be invoked!");
});

Instabug.SetPreInvocationHandler(beforeShowingSDKAction);

New Usage

IBGBugReporting.WillInvokeHandler = () => 
{
  Console.WriteLine("SDK will be invoked!");
};

SetPostInvocationHandler:

Previous Usage

Instabug.SetPostInvocationHandler((IBGDismissType dismissType, IBGReportType reportType) => { 
  System.Console.WriteLine("SDK will be dismissed");
});

New Usage

IBGBugReporting.DidDismissHandler = (IBGDismissType dismissType, IBGReportType reportType) =>
{
    Console.WriteLine("Dismiss Type: " + dismissType + ". Report Type: " +      reportType);
};

SetPreSendingHandler:

Previous Usage

var beforeSendingReportAction = new System.Action(() => {
  System.Console.WriteLine("Report will be sent!");
});
Instabug.SetPreSendingHandler(beforeSendingReportAction);
Instabug.SetPreSendingRunnable(new BeforeSendingReportCallback());

public class BeforeSendingReportCallback : Java.Lang.Object, IRunnable
{
  public void Run()
  {
    Android.Util.Log.Warn("PreSendingReport", "Report will be sent");
  }
}

New Usage

Instabug.WillSendReportHandler = (IBGReport report) =>
{
  report.AppendTag("Tag");
  report.LogVerbose("Verbos log");
  report.AppendToConsoleLogs("Console log");
  report.SetUserAttribute("User Attirbute Value", "Key");
  return report;
};
Instabug.OnReportSubmitHandler(new BeforeSendingReportCallback());

public class BeforeSendingReportCallback : Java.Lang.Object, Report.IOnReportCreatedListener
{
  public void OnReportCreated(Report report)
  {
    report.AddTag("Tag");
    report.LogVerbose("Verbose Log");
    report.AppendToConsoleLogs("Console Log");
    report.SetUserAttribute("User Attribute Value", "Key");
  }
}

SetInvocationEvent:

Previous Usage
It only used to accept one value for the invocation event only

Instabug.SetInvocationEvent(IBGInvocationEvent.FloatingButton);

New Usage

It now accepts multiple invocation event values

IBGBugReporting.InvocationEvents = IBGInvocationEvent.FloatingButton | IBGInvocationEvent.Screenshot;

SetEmailFieldRequired

Previous Usage

Instabug.SetEmailFieldRequired(false);
Instabug.SetEmailFieldRequired(false);

New Usage

IBGBugReporting.InvocationOptions = IBGBugReportingInvocationOption.EmailFieldOptional;
BugReporting.SetInvocationOptions(InvocationOption.EmailFieldOptional);

SetCommentFieldRequired:

Previous Usage

Instabug.SetCommentFieldRequired(true);
Instabug.SetCommentFieldRequired(true);

New Usage

IBGBugReporting.InvocationOptions = IBGBugReportingInvocationOption.CommentFieldRequired;
BugReporting.SetInvocationOptions(InvocationOption.CommentFieldRequired);

SetEmailFieldVisibility:

Previous Usage

// There was no API available for this on iOS for Xamarin
Instabug.SetEmailFieldVisibility(false);

New Usage

IBGBugReporting.InvocationOptions = IBGBugReportingInvocationOption.EmailFieldHidden;
BugReporting.SetInvocationOptions(InvocationOption.EmailFieldHidden);

SetShakingThresholdForiPhone:foriPad:

Previous Usage

Instabug.SetShakingThresholdForiPhone(2.5, 0.6);
Instabug.SetShakingThreshold(5);

New Usage

IBGBugReporting.ShakingThresholdForiPhone = 3.0;
IBGBugReporting.ShakingThresholdForiPad = 1.0;
BugReporting.SetShakingThreshold(5);

setTheme:

Previous Usage

new Instabug.Builder(this, "YOUR_ANDROID_TOKEN")
            .SetInvocationEvent(InstabugInvocationEvent.Shake)
            .SetTheme(InstabugColorTheme.InstabugColorThemeDark)
                        .Build();

New Usage

Instabug.SetColorTheme(InstabugColorTheme.InstabugColorThemeLight);

GetUnreadMessagesCount

Previous Usage

Instabug.GetUnreadMessagesCount();

New Usage

Instabug.UnreadMessagesCount;

SetUserStepsEnabled:

Previous Usage

Instabug.SetUserStepsEnabled(true);

New Usage

Instabug.TrackUserSteps = true;

SetAutoScreenRecordingEnabled:

Previous Usage

Instabug.SetAutoScreenRecordingEnabled(true);

New Usage

Instabug.AutoScreenRecordingEnabled = true;

SetAutoScreenRecordingDuration:

Previous Usage

Instabug.SetAutoScreenRecordingDuration(15);

New Usage

Instabug.AutoScreenRecordingDuration = 15;

SetViewHierarchyEnabled:

Previous Usage

Instabug.SetViewHierarchyEnabled(false);

New Usage

Instabug.ShouldCaptureViewHierarchy = false;

SetFloatingButtonEdge:

Previous Usage

Instabug.SetFloatingButtonEdge(CoreGraphics.CGRectEdge.MaxXEdge, 10);
Instabug.SetFloatingButtonOffsetFromTop(50);

New Usage

IBGBugReporting.FloatingButtonEdge = CoreGraphics.CGRectEdge.MaxXEdge;
IBGBugReporting.FloatingButtonTopOffset = 10;
BugReporting.SetFloatingButtonOffset(50);

setPostSendingDialogEnabled:

Previous Usage

Instabug.SetPostSendingDialogEnabled(false);
Instabug.SetSuccessDialogEnabled(false);

New Usage

IBGBugReporting.InvocationOptions = IBGBugReportingInvocationOption.DisablePostSendingDialog;
BugReporting.SetInvocationOptions(InvocationOption.DisablePostSendingDialog);

SetPrimaryColor:

Previous Usage

Instabug.SetPrimaryColor(UIColor.Red);

New Usage

Instabug.TintColor = UIColor.Red;

LogUserEventWithName:

Previous Usage

var dict = new NSDictionary("key1", 1, "key2", 2);
Instabug.LogUserEventWithName("User Event", dict);

New Usage

Instabug.LogUserEventWithName("User Event");

Notes

Specifying parameters for user events is no longer available.


SetEnabledAttachmentTypes:

Previous Usage

Instabug.SetAttachmentTypesEnabledScreenShot(true,true,true,true,true);

New Usage

IBGBugReporting.EnabledAttachmentTypes = IBGAttachmentType.Screenshot | IBGAttachmentType.ScreenRecording;

// Attachment types
IBGAttachmentType.ScreenRecording
IBGAttachmentType.Screenshot
IBGAttachmentType.ExtraScreenshot
IBGAttachmentType.GalleryImage

SetChatNotificationEnabled:

Previous Usage

Instabug.SetChatNotificationEnabled(false);
Instabug.SetChatNotificationEnabled(false);

New Usage

Instabug.ReplyNotificationsEnabled = false;
Instabug.SetReplyNotificationEnabled(false);

SetOnNewMessageHandler:

Previous Usage

var onNewMessageHandler = new System.Action(() => {
  System.Console.WriteLine("New Message");
});
Instabug.SetOnNewMessageHandler(onNewMessageHandler);
public class IOnNewMessageHandler : Java.Lang.Object, IRunnable
{
  public void Run()
  {
    Android.Util.Log.Warn("OnNewMessage", "New Message Received");
  }
}

Instabug.SetNewMessageHandler(new IOnNewMessageHandler());

New Usage

Instabug.DidRecieveReplyHandler = () =>
{
  System.Console.WriteLine("New Message");
};
public class IOnNewReplyReceivedHandler : Java.Lang.Object, IRunnable
{
  public void Run()
  {
    Android.Util.Log.Warn("OnReplyReceived", "New Reply Received");
  }
}

Instabug.SetOnNewReplyReceivedCallback(new IOnNewReplyReceivedHandler());

SetPromptOptionsEnabledWithBug:

Previous Usage

Instabug.SetPromptOptionsEnabledWithBug(true, true, false);
InstaInstabug.SetPromptOptionsEnabled(true, true, false);

New Usage

IBGBugReporting.PromptOptions = IBGPromptOption.Bug | IBGPromptOption.Chat;
BugReporting.SetPromptOptionsEnabled(PromptOption.Bug, PromptOption.Chat);

SetExtendedBugReportMode:

Previous Usage

Instabug.SetExtendedBugReportMode(IBGExtendedBugReportMode.EnabledWithOptionalFields);

New Usage

IBGBugReporting.ExtendedBugReportMode = IBGExtendedBugReportMode.EnabledWithOptionalFields;

isInstabugNotification:

Previous Usage

Instabug.IsInstabugNotification(notificationDictionary);

New Usage

bool isInstabugNotification = Instabug.DidReceiveRemoteNotification(new NSDictionary());

IBGLog:

Previous Usage

Instabug.IBGLog("Log");
Instabug.LogVerbose("Log");
Instabug.LogInfo("Log");
Instabug.LogWarn("Log");
Instabug.LogDebug("Log");
Instabug.LogError("Log");

New Usage

IBGLog.Log("Log");
IBGLog.LogVerbose("Log");
IBGLog.LogInfo("Log");
IBGLog.LogWarn("Log");
IBGLog.LogDebug("Log");
IBGLog.LogError("Log");

SetIBGLogPrintsToConsole:

Previous Usage

Instabug.SetIBGLogPrintsToConsole(false);

New Usage

IBGLog.PrintsToConsole = false;

SetAutoShowingSurveysEnabled:

Previous Usage

// This API wasn't available in iOS for Xamarin
Instabug.SetSurveysAutoShowing(false);

New Usage

IBGSurveys.AutoShowingEnabled = false;
Surveys.SetAutoShowingEnabled(false);

SetSurveysEnabled:

Previous Usage

Instabug.SetSurveysEnabled(false);

New Usage

IBGSurveys.Enabled = false;

ShowSurveyIfAvailable:

Previous Usage

Instabug.ShowSurveyIfAvailable();
Instabug.ShowValidSurvey();

New Usage

IBGSurveys.ShowSurveyIfAvailable();
Surveys.ShowSurveyIfAvailable();

HasAvailableSurveys:

Previous Usage

Instabug.HasAvailableSurveys();
bool hasValidSurveys = Instabug.HasValidSurveys;

New Usage

IBGSurvey[] surveysList = IBGSurveys.AvailableSurveys;
if(surveysList.Length > 0) {
  surveysList[0].Show();
}
IList<Survey> surveysList = Surveys.AvailableSurveys;
surveysList[0].Show();
string title = surveysList[0].Title;

SetWillShowSurveyHandler:

Previous Usage

var onWillShowSurvey = new System.Action(() => {
  System.Console.WriteLine("New Survey");
});

Instabug.SetWillShowSurveyHandler(onWillShowSurvey);
Instabug.SetPreShowingSurveyRunnable(new IPreShowingSurveyRunnable());
public class IPreShowingSurveyRunnable : Java.Lang.Object, IRunnable
{
  public void Run()
  {
    Android.Util.Log.Warn("PreShowingSurvey", "Pre Showing survey");
  }
}

New Usage

IBGSurveys.WillShowSurveyHandler = () =>
{
  System.Console.WriteLine("New Survey");
};
Surveys.SetOnShowCallback(new IPreShowingSurveyRunnable());
public class IPreShowingSurveyRunnable : Java.Lang.Object, IOnShowCallback
{
  public void OnShow()
  {
    Android.Util.Log.Warn("PreShowingSurvey", "Pre Showing survey");
  }
}

SetDidDismissSurveyHandler:

Previous Usage

Instabug.SetDidDismissSurveyHandler(() =>
{
    System.Console.WriteLine("Did Dismiss Survey");
});
Instabug.SetAfterShowingSurveyRunnable(new IAfterShowingSurveyRunnable());

public class IAfterShowingSurveyRunnable : Java.Lang.Object, IRunnable
{
  public void Run()
  {
    Android.Util.Log.Warn("AfterShowingSurvey", "Survey shown!");
  }
}

New Usage

IBGSurveys.DidDismissSurveyHandler = () =>
{
    System.Console.WriteLine("Did Dismiss Survey");
};
Surveys.SetOnDismissCallback(new IOnDismissSurveyCallback());

public class IOnDismissSurveyCallback : Java.Lang.Object, IOnDismissCallback
{
  public void OnDismiss()
  {
    Android.Util.Log.Warn("PreShowingSurvey", "Pre Showing survey");
  }
}

ShowSurveyWithToken:

Previous Usage

Instabug.ShowSurveyWithToken("TOKEN");
Instabug.ShowSurvey("TOKEN");

New Usage

IBGSurveys.ShowSurveyWithToken("TOKEN");
Surveys.ShowSurvey("TOKEN");

SetThresholdForReshowingSurveyAfterDismiss:daysCount:

Previous Usage

// This API wasn't there in iOS for Xamarin
Instabug.SetThresholdForReshowingSurveyAfterDismiss(3, 5);

New Usage

IBGSurveys.SetThresholdForReshowingSurveyAfterDismiss(3, 5);
Surveys.SetThresholdForReshowingSurveyAfterDismiss(3, 5);

ShowFeatureRequests

Previous Usage

Instabug.ShowFeatureRequests();
Instabug.ShowFeatureRequests();

New Usage

IBGFeatureRequests.Show();
using Com.Instabug.Featuresrequest;
...
FeatureRequests.Show();

HasRespondedToSurveyWithToken

Previous Usage

bool hasResponded = Instabug.HasRespondedToSurveyWithToken("TOKEN");
bool hasResponded = Instabug.HasRespondToSurvey("TOKEN");

New Usage

bool hasResponded = IBGSurveys.HasRespondedToSurveyWithToken("TOKEN");
bool hasResponded = Surveys.HasRespondToSurvey("TOKEN");

SetShouldShowSurveysWelcomeScreen:

Previous Usage

// This Api wasn't available in iOS for Xamarin
Instabug.SetShouldShowSurveysWelcomeScreen(true);

New Usage

IBGSurveys.ShouldShowWelcomeScreen = true;
Surveys.SetShouldShowWelcomeScreen(true);

SetReproStepsMode:

Previous Usage

Instabug.SetReproStepsMode(IBGUserStepsMode.EnabledWithNoScreenshot);

New Usage

Instabug.ReproStepsMode = IBGUserStepsMode.EnabledWithNoScreenshot;

Removed Methods

Instabug.SetWillSkipScreenshotAnnotation(true);

Screenshot annotation step is no longer presented when reporting a bug.

New Methods

SetDidSelectPromptOptionHandler

Instabug.SetDidSelectPromptOptionHandler((IBGPromptOption promptOption) => {
  Console.WriteLine("Prompt Option selected: " + promptOption);
});

IBGFeatureRequests.SetEmailFieldRequired(true, IBGAction.RequestNewFeature);

Use to set whether email is required or not when adding a new feature or adding a comment in feature requests.

IBGFeatureRequests.SetEmailFieldRequired(true, IBGAction.RequestNewFeature 
| IBGAction.AddCommenToFeature);
FeatureRequests.SetEmailFieldRequired(true, Com.Instabug.Featuresrequest.ActionType.AddCommentToFeature, Com.Instabug.Featuresrequest.ActionType.RequestNewFeature);

New Types

iOS

IBGBugReportingInvocationOption

An enum to be used with IBGBugReporting.InvokeWithInvocationMode(IBGInvocationMode.NewBug, IBGBugReportingInvocationOption.EmailFieldHidden);. Possible values are:

  • IBGBugReportingInvocationOption.EmailFieldHidden
  • IBGBugReportingInvocationOption.EmailFieldOptional
  • IBGBugReportingInvocationOption.CommentFieldRequired
  • IBGBugReportingInvocationOption.DisablePostSendingDialog

Android

InvocationOption

An enum to be used with BugReporting.Invoke(InvocationMode.NewBug, InvocationOption.EmailFieldHidden);. Possible values are:

  • InvocationOption.EmailFieldHidden
  • InvocationOption.EmailFieldOptional
  • InvocationOption.CommentFieldRequired
  • InvocationOption.DisablePostSendingDialog

Updated 9 months ago

SDK 8.0 Migration Guide


This page covers the migration steps from previous versions of the SDK to
version 8.0+.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.