Page tree
Skip to end of metadata
Go to start of metadata


  • Drag and drop the HyprMediate.framework (available in the SDK disk image) file into your Xcode project, making sure that the files are copied and not just referenced.  

  • Visit your project's Build Phases, open "Link Binary with Libraries" and add libxml2.tbd
  • Make sure that HyprMediate.framework is listed.
  • Find the key "Other Linker Flags" in the "Linking" section of your project's build settings. For that key, add the value -ObjC. Make sure not to select just "build" or "release" within "Other Linker Flags," but rather the general line above those. 

App Transport Security

Apple has put on hold their efforts to enforce ATS (App Transport Security) settings, so many developers are simply turning it off. In order to do so, add the App Transport Security dictionary key below to your Info.plist.


Your Info.plist would look like this after adding these lines: 

If you prefer to enable ATS, you must add the three App Transport Security dictionary keys below to your Info.plist to ensure HyprMediate operates properly.


Your Info.plist would look like this after adding these lines:

Privacy Controls

iOS 10 requires that if advertisers want access to a user’s camera, calendar, photo library, etc, that they declare the following in the plist. In order to maximize fill rate, please add the following entries to your app's plist.

<string>${PRODUCT_NAME} requests access to the Calendar</string>
<string>${PRODUCT_NAME} requests access to the Photo Library</string>


Import HyprMediate into your file by including the following statement:

 #import <HyprMediate/HyprMediate.h>

Please initialize HyprMediate as soon as possible (i.e. when your application is loading) so preloading will start immediately. We recommend initializing in the AppDelegate.m file.

To initialize HyprMediate, use the following code snippet. If you're in AppDelegate.m, we recommend placing it in the didFinishLaunchingWithOptions: method, since that method is called when your app starts.

[HYPRMediate initialize: hyprAPIToken userId: hyprUserId];

Your app's API token can be found in App Configuration settings on the HyprMediate Waterfall page. Replace hyprAPIToken with an NSString of that token. 


Replace the hyprUserId parameter with any identifier that is static for each user. The hyprUserId is a unique identifier supplied by your application and should be static for each user across sessions. Your hyprUserId should not contain any personally identifiable information such as an email address, screen name, or Apple’s Advertising Identifier (IDFA). The code below can be used to generate your hyprUserID. If you don't already have a static user id, you can use the code below to generate one.

NSString *userIdStorageKey = @"hyprMarketplaceUserId";
NSString *userId = [[NSUserDefaults standardUserDefaults] objectForKey:userIdStorageKey];
if (!userId) {
    userId = [[NSUUID UUID] UUIDString];
    [[NSUserDefaults standardUserDefaults] setObject:identifier forKey:userIdStorageKey];
    [[NSUserDefaults standardUserDefaults] synchronize];
// initialize HYPRManager with `userId`

You will need to implement HyprMediateDelegate.  

@interface YourHyprMediateDelegateImplementation : NSObject <HyprMediateDelegate>

The required delegate methods are listed below.

Set your delegate to get callbacks from HyprMediate:

YourHyprMediateDelegateImplementation *delegate = [[YourHyprMediateDelegateImplementation alloc] init];
[HYPRMediate setDelegate: delegate];

Important: The HyprMediate SDK keeps a strong reference to the HyprMediateDelegate you set.  If you implement the HyprMediateDelegate interface with a UIViewController, be sure to set the delegate to nil in the parent UIViewController that is dismissing the delegate, before dismissViewController: is called.


Check For Ads, Show Ads

After initializing, HyprMediate will be ready to check if ads are available. This is done before attempting to show an ad.  

// Check if ads are available. HyprMediate will call back your delegate's hyprMediateCanShowAd method when it has an answer for you.
[HYPRMediate checkInventory];

Once you know an ad is available and the user taps on the UI element, you can show the ad.

// Place this method in the event handler used for presenting ads. HyprMediate will call back the delegate methods implemented below.
[HYPRMediate showAd];

Both checkInventory and showAd will call back your HyprMediateDelegate. Implement the following methods on your delegate.

- (void)hyprMediateCanShowAd:(BOOL)adCanBeDisplayed {
    if (adCanBeDisplayed) {
		NSLog(@"HYPRMediate can show an ad.");
    } else {
		NSLog(@"HYPRMediate does not have an ad to show.");
- (void)hyprMediateAdStarted {
	// HyprMediate started displaying an ad.
	// This is the appropriate time to pause any background music or game animations.

- (void)hyprMediateAdFinished {
	// HyprMediate finished displaying an ad.
	// This is the appropriate time to resume music and animations.
- (void)hyprMediateRewardDelivered:(HYPRMediateReward *)reward {
	// The user earned a reward. You may deliver it here.
	// If you are using server to server callbacks, this may be a useful time to check in with your servers.
	NSLog(@"User earned %qi %@", reward.virtualCurrencyAmount, reward.virtualCurrencyName);

- (void)hyprMediateErrorOccurred:(HYPRMediateError *)error {
	// Something went wrong with the ad display. Look at the error object for more information.
	// See the HYPRMediateErrorType for more information about types of errors.
    NSLog(@"%@", [error description]);

NOTE: Using alert views inside of callbacks may cause UI issues with some ad providers. For this reason, we recommend you don't use UIAlertViews in HyprMediate callbacks.


Initialization Callbacks (Optional)

If you would like to receive a callback after HyprMediate completes initialization, implement the following method.

- (void)hyprMediateInitializationComplete {
    // HyprMediate has finished initializing
 	// It is now safe to check for ad inventory	

That's it! You're up and running with HyprMediate. To add more ad providers, click here.

  • No labels