SFNetwork Class Reference

Inherits from NSObject
Declared in SFNetwork.h

  activeSession

@property (nonatomic, readonly, strong, nonnull) NSURLSession *activeSession

  metricsCollectedAction

The block to execute to execeute when metrics are collected on URL session task, if provided.

@property (class, nonatomic, copy, nullable) SFSDKMetricsCollectedBlock metricsCollectedAction

Declared In

SFNetwork.h

+ sharedEphemeralInstance

Returns an instance of this class with the default ephemeral session configuration.

+ (nonnull instancetype)sharedEphemeralInstance

Return Value

Instance of this class.

Declared In

SFNetwork.h

+ sharedBackgroundInstance

Returns an instance of this class with the default background session configuration.

+ (nonnull instancetype)sharedBackgroundInstance

Return Value

Instance of this class.

Declared In

SFNetwork.h

+ sharedEphemeralInstanceWithIdentifier:

Returns instance of this class for the given identifier with the default ephemeral session configuration.

+ (nonnull instancetype)sharedEphemeralInstanceWithIdentifier:(nonnull NSString *)identifier

Return Value

Instance of this class.

Declared In

SFNetwork.h

+ sharedBackgroundInstanceWithIdentifier:

Returns instance of this class for the given identifier with the default background session configuration.

+ (nonnull instancetype)sharedBackgroundInstanceWithIdentifier:(nonnull NSString *)identifier

Return Value

Instance of this class.

Declared In

SFNetwork.h

+ sharedInstanceWithIdentifier:sessionConfiguration:

Returns an instance of this class with the given session configuration.

+ (nonnull instancetype)sharedInstanceWithIdentifier:(nonnull NSString *)identifier sessionConfiguration:(nonnull NSURLSessionConfiguration *)sessionConfiguration

Parameters

identifier

Identifier for the instance

sessionConfiguration

Configuration to use for the session.

Return Value

Instance of this class.

Declared In

SFNetwork.h

– sendRequest:dataResponseBlock:

Sends a REST request and calls the appropriate completion block.

- (nonnull NSURLSessionDataTask *)sendRequest:(nonnull NSURLRequest *)urlRequest dataResponseBlock:(nullable SFDataResponseBlock)dataResponseBlock

Parameters

urlRequest

NSURLRequest instance.

dataResponseBlock

Network response block.

Return Value

NSURLSessionDataTask instance.

Declared In

SFNetwork.h

+ setSessionConfiguration:identifier:

Sets a session configuration to be used for network requests in Mobile SDK.

+ (void)setSessionConfiguration:(nonnull NSURLSessionConfiguration *)sessionConfig identifier:(nonnull NSString *)identifier

Parameters

sessionConfig

Session configuration to be used.

identifier

Identifier for the instance to use this config.

Declared In

SFNetwork.h

+ removeSharedEphemeralInstance

Removes shared instance for the default ephemeral identifier.

+ (void)removeSharedEphemeralInstance

Declared In

SFNetwork.h

+ removeSharedBackgroundInstance

Removes shared instance for the default background identifier.

+ (void)removeSharedBackgroundInstance

Declared In

SFNetwork.h

+ removeSharedInstanceForIdentifier:

Removes shared instance for given identifier.

+ (void)removeSharedInstanceForIdentifier:(nullable NSString *)identifier

Parameters

identifier

Identifier for the session.

Declared In

SFNetwork.h

+ removeAllSharedInstances

Removes all shared instances.

+ (void)removeAllSharedInstances

Declared In

SFNetwork.h

+ sharedInstanceIdentifiers

Returns list of identifiers for all shared instances.

+ (nullable NSArray *)sharedInstanceIdentifiers

Return Value

Array of identifiers.

Declared In

SFNetwork.h

+ uniqueInstanceIdentifier

Generates a unique instance identifier.

+ (nonnull NSString *)uniqueInstanceIdentifier

Declared In

SFNetwork.h