MoEngageFetchRecommendationsTask
@objc(MoEngageFetchRecommendationsTask)
public final class MoEngageFetchRecommendationsTask : MoEngageBaseTask, MoEngageTaskProtocol
Typed task returned by MoEngageSDKRecommendations.fetchRecommendations(...).
Resolves with MoEngageRecommendedItems — either from the local cache when
a valid entry exists for the request, or from the server. An empty items
array resolves as a success; “no recommendations right now” is a valid
answer rather than a fault.
onFailure fires with MoEngageRecommendationsRequestFailureReason whose
moduleCode is one of .invalidRequest, .payloadTooLarge,
.rateLimitExceeded, .internalServerError or .unknownError. Failures
raised before the module is reached carry a nil moduleCode and a shared
code instead — .sdkNotInitialized when no SDK instance is registered for
the supplied workspace id, .featureDisabled when the SDK is disabled or
Recommendations is blocked by remote config, and .networkError /
.parseError for transport and decoding failures.
Handlers are single-slot and always dispatched on the main thread. Attaching
onSuccess / onFailure and awaiting result() on the same task drops
the closures — use one surface per task.
-
Declaration
Swift
public typealias Success = MoEngageRecommendedItems -
Declaration
Swift
public typealias Failure = MoEngageRequestFailure