- 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.
- By default, HyprMediate is built to deploy on iOS 8 and above. This allows it to automatically import the Apple frameworks it links with. If your app deploys to iOS 7, manually link WebKit as Optional.
App Transport Security
Starting January 1st, 2017, ATS (App Transport Security) will be required for any apps submitted to the App Store. In order to accommodate the reality that many ad networks, advertisers, and products are not yet ready for a 100% SSL world, Apple allows app developers to customize these settings, for example to allow HTTP loads for web views and media.
NSAllowsArbitraryLoadsis required for iOS 9 backwards compatibility.
Open Info.plist, and add the following lines:
Your Info.plist should look like this after adding these lines:
When you submit your application, you will have to provide justification for these ATS settings. We recommend you note that your ad partners require loading web content from a variety of sources, including those that do not yet support HTTPS. Apple has already noted that this is acceptable justification in their documentation.
Import HyprMediate into your file by including the following statement:
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.
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.
hyprUserId parameter with any identifier that is static for each user. If you don't have a static identifier, and your app uses Game Center, you can retrieve the user's unique player ID:
You will need to implement HyprMediateDelegate.
The required delegate methods are listed below.
Set your delegate to get callbacks from HyprMediate:
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.
Once you know an ad is available and the user taps on the UI element, you can show the ad.
Both checkInventory and showAd will call back your HyprMediateDelegate. Implement the following methods on your delegate.
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.