# Interceptor Lifecycle

It is of most importance to properly manage Codavel SDK interceptor lifecycle.

Internally, when Codavel SDK interceptor is started, it launches a service that manages all its components, and during its startup process, it takes some milliseconds to launch. Thus, you should carefully choose the moment to launch it properly. Failing to do it correctly may cause a bad user-experience.

# Start Interceptor

When integrating the Codavel SDK interceptor into an application, it is essential to consider where network requests are performed.

When network requests are limited to single View, the best place to start the Codavel SDK interceptor is in the ViewController file, inside the viewDidLoad method. Thus, the Codavel SDK integration will be limited to the intended view, with the Codavel SDK interceptor being started once, after the view finishes its loading.

In the case of a global app integration, the best place to start Codavel SDK the interceptor is in the AppDelegate file, inside the didFinishLaunchingWithOptions method.

# Stop Interceptor

If you start the interceptor as soon as possible in your app, as in case of a global app integration, there is no need to force the interceptor to stop. The interceptor will follow the app lifecycle and will be destroyed when the app itself is destroyed.

However, if you have a specific place or View where you expect to use Codavel CDN, we recommend you stop the Codavel SDK interceptor when the user leaves that place or View.

# Diagnostic Tool

The Diagnostic Tool is a feature that, when enabled, validates and assesses if the main Codavel SDK is properly integrated with your app.

# Enable the Diagnostic Tool

Assuming you've integrated bolina into your app with one of the available libs, add the following block of code after the start of the interceptor:

  • Swift
  • Objective-C

# Diagnostic Tool results

In your Codavel private area, you will have access to a dashboard where you can visualize all the information collected by this tool and identify any issue with your integration.