Ads
-
RichieAds is the old main interface to Richie SDK’s ad system. You should look at
RichieAdsController
with new code.NOTE: Many RichieAds methods are thread-safe, but their correct operation from the caller’s point of view requires them to be called from a single thread. Using RichieAds from main thread only is recommended. If slot ads are used, use from main thread is mandatory to ensure correct state observing from the client’s point of view.
-placeholderImageForAdWithIdentifier:
methods are explicitly safe and good to be used from any thread.-viewForAdWithIdentifier:
is explicitly main thread only.Timing of calling
-startLoadingAd
and-containerWillBeDeleted
may result in situations the caller didn’t intend or could not foresee, if multiple places of an app call these from multiple threads. Download state will change in a background thread, meaning calling-startLoadingAdWithIdentifier:
and immediately calling-hasLoadedAdWithIdentifier:
may returnYES,
in case an actual download wasn’t required (creative had been downloaded to another container).It’s safe to manipulate a container from a single thread (preferably the main thread, which is used to post notifications). Even then state can be unexpected after calling
See more-startLoadingAdWithIdentifier:.
A supported and safe pattern is to usehasLoadedAdWithIdentifier:
and then start loading the ad with-startLoadingAdWithIdentifier:
if ad hasn’t been loaded. App should then wait for ad did load notification.Declaration
Objective-C
@interface RichieAds : NSObject
Swift
@MainActor class RichieAds : NSObject
-
Undocumented
See moreDeclaration
Objective-C
@interface RichieAdsSlotAdFlight : NSObject -(nonnull instancetype) init NS_UNAVAILABLE; @end
Swift
class RichieAdsSlotAdFlight : NSObject
-
Undocumented
See moreDeclaration
Objective-C
@interface RichieAdsView : UIView @property (nonatomic, readonly, nonnull) NSString *adIdentifier; -(void) didAppear; //!< MUST be called by host application when RichieAdsView becomes visible on screen and can be interacted by the user. NOTE: implementation cause heavy operations, don't call while app must stay responsive. Do not call this method until the view is actually visible on screen and the user is able to begin interacting with it. Calling this method prematurely will cause possible animations and timers of creatives to be wrong. -(void) didDisappear; //!< MUST be called by host application when RichieAdsView is not visible on screen and user cannot interact with it anymore. This method automatically does nothing if a modal viewController is presented over the -richieView:viewControllerForPresentingModalInAppBrowserForURL:. -(void) preloadAdContent; //!< Can be called to hint the RichieAdsView to preload HTML ad content without making it active. This operation can be heavy and it can cause performance issues and increased memory usage. Use with caution. -(void) invalidate; //!< SHOULD be called when view is removed from view hierarchy and discarded. -(void) setMaximumResizeSize:(CGSize)maximumResizeSize; //!< SHOULD be called when view is laid out, so it can provide the information for MRAID compliant creative. @property (nonatomic, readonly, weak, nullable) id<RichieAdsViewDelegate> delegate; @end
Swift
class RichieAdsView : UIView
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull RichieAdsDidFailLoadingAdNotification
Swift
static let RichieAdsDidFailLoadingAd: NSNotification.Name
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull RichieAdsDidLoadAdNotification
Swift
static let RichieAdsDidLoadAd: NSNotification.Name
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull RichieAdsDidProgressDownloadingAdNotification
Swift
static let RichieAdsDidProgressDownloadingAd: NSNotification.Name
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull RichieAdsDidStartLoadingAdNotification
Swift
static let RichieAdsDidStartLoadingAd: NSNotification.Name
-
Undocumented
Declaration
Objective-C
extern NSString * _Nonnull const RichieAdsErrorDomain
Swift
let RichieAdsErrorDomain: String
-
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull RichieAdsSlotsDidChangeNotification
Swift
static let RichieAdsSlotsDidChange: NSNotification.Name
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull kRichieAdsAdIdentifierKey
Swift
let kRichieAdsAdIdentifierKey: String
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull kRichieAdsContainerURLKey
Swift
let kRichieAdsContainerURLKey: String
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull kRichieAdsDownloadedBytesKey
Swift
let kRichieAdsDownloadedBytesKey: String
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull kRichieAdsErrorKey
Swift
let kRichieAdsErrorKey: String
-
Deprecated
Undocumented
Declaration
Objective-C
extern NSString * const _Nonnull kRichieAdsExpectedTotalBytesKey
Swift
let kRichieAdsExpectedTotalBytesKey: String
-
Undocumented
See moreDeclaration
Objective-C
@protocol RichieAdsViewDelegate <NSObject> @required -(nonnull UIViewController *) viewControllerForPresentingFromRichieAdsView:(nonnull RichieAdsView *)view; @optional -(void) richieAdsViewDidShowContent:(nonnull RichieAdsView *)view; //!< Called when RichieAdsView has loaded some content (placeholder image or HTML) for display. -(BOOL) richieAdsView:(nonnull RichieAdsView *)view wantsResizeToFrame:(CGRect)frame; //!< Return YES if the view will be (or already has been) resized to the supplied frame. -(void) richieAdsViewResizeEnded:(nonnull RichieAdsView *)view; @end
Swift
@MainActor protocol RichieAdsViewDelegate : NSObjectProtocol