HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center
These docs are for v8.2. Click to read the latest docs for v13.0.0.

Method Swizzling

User Steps

Instabug automatically tracks steps users have taken in the app before a bug is reported or a crash has occurred. This gives you great insights on how to reproduce the issue your users have encountered. Note that the maximum number of user steps sent with each report is 100.

To be able to capture the user steps, we need to do some method swizzling. We take an approach to swizzling that is absolutely safe and does not impact your app negatively in any way. In all the methods we swizzle, we call the original implementation to make sure we never break your app.
Method swizzling done in the Instabug SDK never impacts the performance of your app. All the methods we swizzle only log events, and this is done in a low-priority background queue. As displayed in the following message the sizzling overhead is 1.0 ms.

683

As of the latest version of the SDK, we swizzle the following methods:

  • - [UIApplication sendAction:to:from:forEvent:]: we log the action, target, sender and current view.
  • - [UIApplication sendEvent:]: we log the event type (touch, motion, etc). For privacy, we ignore any touch events on the keyboard.

To be able to keep track of the top visible view controller, we also swizzle the following methods:

  • - [UIWindow resignKeyWindow]
  • - [UIWindow becomeKeyWindow]
  • - [UIViewController viewDidAppear:]
  • - [UIViewController viewDidDisappear:]

Finally, only when running on the iOS simulator, we swizzle - [UIResponder motionEnded:withEvent:] to be able to respond to shake gestures.

All method swizzling done by the iOS SDK is absolutely safe and has no negative impact on the performance of your app, but if you decide you don’t want any method swizzling in your app, you can disable it by disabling user steps using the following method:

[Instabug setTrackUserSteps:NO];
Instabug.trackUserSteps = false