# pop.onl iOS SDK

Free ad mediation. pop.onl calls each ad network's own SDK directly, in the waterfall order you set on
[pop.onl](https://pop.onl); no other mediation sits in between. Formats: rewarded and interstitial. iOS 13+.

> Status: written against each network's documented API, not yet compiled on a Mac. Treat 0.1.0 as a preview.

## Install

CocoaPods (all adapters):

```ruby
pod 'PopOnlAds'            # core
pod 'PopOnlAds/AdMob'      # one line per network you turned on at pop.onl
pod 'PopOnlAds/UnityAds'
pod 'PopOnlAds/Pangle'
pod 'PopOnlAds/Liftoff'
pod 'PopOnlAds/InMobi'
```

Swift Package Manager (core and AdMob): add `https://github.com/poponl/sdk`, products `PopOnlAds`, `PopOnlAdMob`.

Each network also asks for its own Info.plist entries (SKAdNetworkItems; for AdMob, `GADApplicationIdentifier`).
Copy them from the network's docs.

## Use

```swift
import PopOnlAds

// AppDelegate
PopOnlAds.setConsent(true)            // from your consent prompt (GDPR); leave unset if unknown
PopOnlAds.initialize(appKey: "po_app_XXXXXXXXXXXXXXXXXXXX")

// A view controller
if PopOnlAds.isRewardedReady("revive") {
    PopOnlAds.showRewarded(from: self, placement: "revive") { earned in if earned { giveReward() } }
}
PopOnlAds.showInterstitial(from: self, placement: "level_end")
```

Adapters in the app register themselves (classes named `PopOnlAdapter_<network>`). Callbacks run on the main thread.

## Networks

| Network | Subspec | Set on pop.onl (app) | Line id |
|---|---|---|---|
| AdMob | `AdMob` | — (app id in Info.plist) | ad unit id |
| Unity Ads | `UnityAds` | game_id_ios or game_id | placement id |
| Pangle | `Pangle` | app_id | placement id |
| Liftoff (Vungle) | `Liftoff` | app_id | placement reference id |
| InMobi | `InMobi` | account_id | placement id (number) |

Next on iOS: Mintegral, Chartboost, DT Exchange, Yandex, BIGO Ads, myTarget, Smaato, Ogury, Start.io, LINE,
SuperAwesome, YSO Network (all have Android adapters already).
