Platform-Specific Troubleshooting

Below, we’ll try to help you out with troubleshooting any issues you may have when working with the DexCare SDK.

  • Logger

    In most scenarios, adding a simple logger can give insight on what is incorrect.

    DexcareSDKLogger

    The DexcareSDKLogger is a protocol that you can use to see more information about what the SDK does. If an instance of DexcareSDKLogger is attached on initialization, the SDK will post results, errors, information to the logger, which can help you debug issues.

    The DexcareSDKLogger has one function you must implement: func log(_ message: String, level: DexcareSDKLogLevel, sender: String)

    // Example `DexcareSDKLogger` to pass into the SDK.
    // Pass ConsoleLogger() into the SDK init method to post NSLog's to the console.
    class ConsoleLogger: DexcareSDKLogger {
        static var shared: ConsoleLogger = ConsoleLogger()
        func log(_ message: String, level: DexcareSDKLogLevel, sender: String) {
            let emoji: String
            switch level {
                case .verbose: emoji = "➡️"
                case .debug: emoji = "✳️"
                case .info: emoji = "✏️"
                case .warning: emoji = "⚠️"
                case .error: emoji = "❌"
            }
            NSLog("\(emoji) \(sender): \(message)")
        }
    }
    
    

    As an example, if the above is implmented, and a function call fails to the server, it will print to the console:

    ❌ DexcareSDK: Response error in 1.58s for: https://dexcareurl.com/api/7/visits/providerbooking?product=healthconnect-iOS - Status: 500 - Correlation: AD5C5189-DC90-46CB-A5F8-2641A0886E2C
    

    Correlation

    :heavy_check_mark: By providing the Correlation GUID to your dexcare contact, we can easily tell what went wrong in the call. :tada:

    Without it, it is more difficult to search on a server log to try and find out what happened.

    Proxy

    There are proxy observer apps that you can install on your machine to help you debug further what could be wrong. Proxies allow you to view what json is sent and returned from within the SDK to an API call. Charles Proxy and Proxyman are good examples.

    Cocoapod Issues

    Changes in Xcode 12 have changed the way we need to use cocoapods. Please see the v6.0 Migration Guide

  • Chuck

    The Android SDK uses the Chuck library for debugging network requests directly on the device.

    The Environment instance you pass in to the SDK has a isProd boolean. When set to false, the SDK adds a ChuckInterceptor to its internal OkHttpClient. You will then see network requests appear in the Android notification status bar.

Correlation-Id Header

On every network request, the SDK adds a header named Correlation-Id. This is simply a unique guid that allows us to track a particular network request through all of DexCare’s internal services and APIs. If you believe an issue you’re seeing on the SDK is related to one of the DexCare APIs, providing us the Correlation-Id header value will greatly help us debug the issue and implement a fix.

Filing a bug report or feature request

Please feel free to open GitHub issues if you believe the DexCare SDK is not behaving correctly.