IronSource Mediation Adapter for iOS apps looking to load and show Rewarded Surveys from Pollfish in the same waterfall with other Rewarded Ads.
Note: A detailed step by step guide is provided on how to integrate can be found here
Download the following frameworks
and add them in your App's target dependecies
- Navigate to your project
- Select your App's target and go to the General tab section Frameworks, Libraries and Embedded Content
- Add all three dependent framewokrs one by one by pressing the + button -> Add other and selecting the appropriate framework
Add the following frameworks (if you don’t already have them) in your project
- AdSupport.framework
- CoreTelephony.framework
- SystemConfiguration.framework
- WebKit.framework (added in Pollfish v4.4.0)
OR
Add a Podfile with PollfishIronSourceAdapter pod reference:
pod 'PollfishIronSourceAdapter'
You can find the latest PollfishIronSourceAdapter version on CocoaPods here
Run pod install on the command line to install PollfishIronSourceAdapter pod.
Swift
If you are using swift, you need to make sure your application is pointing to IronSource.h
file to include the bridge you need.
Select your Project from the project navigator and navigate to Build Settings -> Swift Compiler - General and add the following path to the Objective-C Bridging Header setting.
The path to the bridging header varies according to the way the integration was done
CocoaPods
${PODS_ROOT}/IronSourceSDK/IronSource/IronSource.xcframework/ios-arm64_armv7/IronSource.framework/Versions/A/Headers/IronSource.h
Manual
Frameworks/IronSource.framework/Headers/IronSource.h
Once you’ve completed the above step, you can use Swift seamlessly within the ironSource SDK, without importing any additional Header Files.
Objective C
#import <IronSource/IronSource.h>
Initialize the IronSource SDK in your ViewController's viewDidLoad
method, passing your App Key as provided by the IronSource dashboard.
Swift
override func viewDidLoad() {
...
ISIntegrationHelper.validateIntegration()
IronSource.setRewardedVideoDelegate(self)
IronSource.initWithAppKey("APP_KEY")
}
Objective C
- (void)viewDidLoad {
...
[ISIntegrationHelper validateIntegration];
[IronSource initWithAppKey:@"APP_KEY"];
[IronSource setRewardedVideoDelegate:self];
}
Comform to ISRewardedVideoDelegate
so that you are notified when your ad is ready and of other ad-related events.
Swift
class ViewController: UIViewController, ISRewardedVideoDelegate
Objective C
@interface ViewController ()<MARewardedAdDelegate>
When the Rewarded Ad is ready, present the ad by invoking IronSource.showRewardedVideo
.
Swift
IronSource.showRewardedVideo(with: self)
Objective C
[IronSource showRewardedVideoWithViewController:self];
You can view a short example on how to intergate rewarded ads below
Swift
import ObjectiveC.runtime
import AppTrackingTransparency
class ViewController: UIViewController, ISRewardedVideoDelegate {
...
@IBOutlet weak var showRewardedAdButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
ATTrackingManager.requestTrackingAuthorization { status in
self.createRewardedAd()
}
}
private func createRewardedAd() {
ISIntegrationHelper.validateIntegration()
IronSource.setRewardedVideoDelegate(self)
IronSource.initWithAppKey(appKey)
}
@IBAction func showRewardedAd(_ sender: Any) {
IronSource.showRewardedVideo(with: self)
}
#pragma mark - ISRewardedVideoDelegate Protocol
public func didReceiveReward(forPlacement placementInfo: ISPlacementInfo!) {}
func rewardedVideoDidFailToShowWithError(_ error: Error!) {}
func rewardedVideoDidOpen() {}
func rewardedVideoDidClose() {}
func rewardedVideoDidEnd() {}
func rewardedVideoDidStart() {}
func rewardedVideoHasChangedAvailability(_ available: Bool) {
showRewardedAdButton.isEnabled = available
}
func didClickRewardedVideo(_ placementInfo: ISPlacementInfo!) {}
}
Objective C
#import <IronSource/IronSource.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>
@interface ViewController()<ISRewardedVideoDelegate>
@property (weak, nonatomic) IBOutlet UIButton *showRewardedAdBtn;
@end
@implementation ViewController
...
- (void)viewDidLoad {
[super viewDidLoad];
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
[self createRewardedAd];
}];
}
- (void)createRewardedAd
{
[ISIntegrationHelper validateIntegration];
[IronSource initWithAppKey:@"APP_KEY"];
[IronSource setRewardedVideoDelegate:self];
}
- (IBAction)showRewardedAd:(id)sender {
[IronSource showRewardedVideoWithViewController:self];
}
#pragma mark - ISRewardedVideoDelegate Protocol
- (void)rewardedVideoHasChangedAvailability:(BOOL)available {
dispatch_async(dispatch_get_main_queue(), ^{
[self.showRewardedAdBtn setEnabled:available];
});
}
- (void)didReceiveRewardForPlacement:(ISPlacementInfo *)placementInfo {}
- (void)rewardedVideoDidFailToShowWithError:(NSError *)error {}
- (void)rewardedVideoDidOpen {}
- (void)rewardedVideoDidClose {}
- (void)rewardedVideoDidStart {}
- (void)rewardedVideoDidEnd {}
- (void)didClickRewardedVideo:(ISPlacementInfo *)placementInfo {}
@end
If you everything worked fine during the previous steps, you should turn Pollfish to release mode and publish your app.
Note: After you take your app live, you should request your account to get verified through Pollfish Dashboard in the App Settings area.
Note: There is an option to show Standalone Demographic Questions needed for Pollfish to target users with surveys even when no actually surveys are available. Those surveys do not deliver any revenue to the publisher (but they can increase fill rate) and therefore if you do not want to show such surveys in the Waterfall you should visit your App Settings are and disable that option.
You can read more info on how the Pollfish SDKs work or how to get started with IronSource at the following links: