AdRequestConnection
@objc(AASDKAdRequestConnection)
public final class AdRequestConnection : NSObject
The AdRequestConnection
represents a single connection to the AdsWizz ad server.
The ad request settings are encapsulated in a reusable AdRequest
object.
The AdRequestConnection
object encapsulates the states of a single communication.
E.g. starting/canceling/finishing a connection.
-
AdsRequestCompletion
A closure that is passed to requestAds() to register for a callback with the results of that ad request once the connection completes. Pass a closure of this type when calling requestAds(). This will be called when the ad request completes. The call will always occur on the UI thread.
adManager
is the ad manager instance created by the ad request connection, responsible for firing impression, quartiles and playing ads.error
is theError
representing any error that occurred.Declaration
Swift
public typealias AdsRequestCompletion = (_ adManger: AdManager?, _ error: Error?) -> Void
-
The timeout in seconds for an ad request. The request timeout is calculated as
max(timeout, 3)
.Declaration
Swift
public var timeout: TimeInterval
-
Undocumented
Declaration
Swift
@objc public var objc_timeout: NSNumber { get set }
-
Request ads from the Adswizz ad server.
Declaration
Swift
@objc public func requestAds(completion: @escaping AdsRequestCompletion)
Parameters
completion
A handler to call back when the ad request completes or times out.
-
requestAds()
AsynchronousRequest ads from the Adswizz ad server in an async context. Use the variant with a completion handler instead if your implementation does not provide an async context.
Throws
an error if the request failed due to connectivity issues or a bad response from the AdServerDeclaration
Swift
@objc public func requestAds() async throws -> AdManager
Return Value
the
AdManager
instance if request was successful -
Cancel a request for ads.
Declaration
Swift
@objc public func cancel()