NetworkManager

@objc(SFMCSdkNetworkManager)
open class NetworkManager : NSObject

This class is a helper for making synchronous and asynchronous network calls with an optional authenticator.

  • Tag: NetworkManager
  • Declaration

    Swift

    @objc
    public init(networkPreferences: SecurePrefs, authenticator: Authenticator?)
  • Executes synchronous network call.

    Declaration

    Swift

    @objc
    open func executeSync(_ wrappedRequest: WrappedRequest) -> CompletedCall

    Parameters

    wrappedRequest

    instance of WrappedRequest

    Return Value

    instance of CompletedCall that contains both the request and the response

  • Executes aynchronous network call.

    Declaration

    Swift

    @objc
    open func executeAsync(_ wrappedRequest: WrappedRequest, completionHandler: @escaping (CompletedCall) -> Void)

    Parameters

    wrappedRequest

    instance of WrappedRequest

    completionHandler

    callback on response

  • Temporarily blocks retries of given request. Waiting time is stored in the network preferences under the requests name key.

    Declaration

    Swift

    @objc
    open func isBlockedByRetryAfter(_ requestName: String) -> Bool

    Parameters

    requestName

    Name of the request

    Return Value

    Bool