-
Notifications
You must be signed in to change notification settings - Fork 2
Setup HyBid
As you might have noticed, there are some breaking changes and deprecations that are introduced with v: 2.21.0. What that means is that if your project uses the older version of the HyBid SDK, we encourage you to check out the Migration to HyBid iOS SDK v: 2.21.0 document here for a smoother migration.
There are 2 ways that you can install HyBid into your application;
-
Download
HyBid.xcframework
and simply drag and drop theHyBid.xcframework
file and the content ofOMSDK_Pubnativenet
folder into your project's target.
IMPORTANT NOTES:
- Make sure for both
HyBid.xcframework
andOMSDK_Pubnativenet.xcframework
are set for Embed & Sign in General, under "Frameworks, Libraries and Embedded Content". - If you face an error similar to:
Missing path from XCFramework 'HyBid.xcframework' as defined by 'DebugSymbolsPath' in its Info.plist file
make sure to remove/comment out the *.dSYM
line from your project's .gitignore
file.
- If you're using CocoaPods, you can add the following line to your
Podfile
. This will get you the full featured HyBid iOS SDK.
pod 'HyBid', '3.1.4'
- However, if you want a specific feature / some features from the HyBid iOS SDK, now you can get them by installing the desired module(s). Down below you'll find a list to the available modules. You can install as little as one module, or multiple modules based on your application's need by adding them to your
Podfile
.
For Banner Ads
pod `HyBid/Banner`, '3.1.4'
For Fullscreen / Interstitial Ads
pod `HyBid/FullScreen`, '3.1.4'
For Rewarded Video Ads
pod `HyBid/RewardedVideo`, '3.1.4'
For Native Ads
pod `HyBid/Native`, '3.1.4'
NOTE: If you already have the previous versions of HyBid iOS SDK in your project and you are updating to the HyBid.xcframework
, you need to remove the Run Script under Build Phases. You don't need that anymore.
NOTE: Make sure you add the following to your app's info.plist
:
<key>NSLocationWhenInUseUsageDescription</key>
<string>A simple text that describes why your app needs the location</string>
There are 2 ways that you can install Adapters into your application;
To use the Adapters in your project, head over to either MoPub HyBid Adapters and/or Google Mobile Ads HyBid Adapters repository and import all the adapter files to your project.
To use the Adapters in your Swift project, ensure that you have a Bridging Header file in your project and the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header
- If you're using CocoaPods, you can add the adapters to your project using
Podfile
. Check the listed repositories for a detailed integration guide for MoPub HyBid and Google Mobile Ads HyBid adapters.
SKAdNetwork
is an attribution solution introduced by Apple. It validates advertiser-driven app installations without disclosing user-level data. Starting with the iOS 14, the utilization of SKAdNetwork
framework will become more important since IDFA (Apple’s Identifier for Advertiser) is going to be opted-out by default.
To comply with SKAdNetwork
standards,
- Control-click or Right-click a property list (
Info.plist
) in the Project navigator, then choose Open As > Source Code from the pop-up menu - Add a
SKAdNetworkItems
key withSKAdNetworkIdentifier
values to yourInfo.plist
, by using this code.
Add the HyBid.framework
to your code.
Swift:
import HyBid
Objective-C:
#import <HyBid/HyBid.h>
#if __has_include(<HyBid/HyBid-Swift.h>)
#import <HyBid/HyBid-Swift.h>
#else
#import "HyBid-Swift.h"
#endif
Before making any requests, you must initialise HyBid iOS SDK by calling init()
method and wait for its completion. Ideally, you should call this init()
method in your app's AppDelegate.
Swift:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//...
//....
HyBid.initWithAppToken("<YOUR_APP_TOKEN_HERE>", completion: nil)
//...
//....
return true
}
Objective-C:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//...
//....
[HyBid initWithAppToken:@"<YOUR_APP_TOKEN_HERE>" completion:nil];
//...
//....
return YES;
}
There are certain parameters that should be configured in the SDK before doing any type of interaction with it. Ensure to configure these parameters only 1 per session.
If your app is intended for children you should set COPPA as true
in order to protect the privacy of the information in their devices. It is disabled by default.
Swift:
HyBid.setCoppa(Bool)
Objective-C:
[HyBid setCoppa:BOOL];
In development, you should set Test Mode as true
for our SDK and disable it in the release. It allows not to track impressions and tracks on the server side of development application:
Swift:
HyBid.setTestMode(Bool)
Objective-C:
[HyBid setTestMode:BOOL];
If the user has given location permissions, HyBid SDK will use the available user location to provide better targeted ads. This feature is enabled by default, but can be disabled by setting the HyBid.setLocationTracking on the HyBid class:
Swift:
HyBid.setLocationTracking(Bool)
Objective-C:
[HyBid setLocationTracking:BOOL];
The SDK refreshes the user location after every ad request if the user has given permission for location tracking. This is done to keep the best accuracy possible. However if the app will do many requests in a short time it might display location updates very often which can be intrusive for some users.
You can disable this behaviour by setting the setLocationUpdatesEnabled on the HyBid class:
Swift:
HyBid.setLocationUpdates(Bool)
Objective-C:
[HyBid setLocationUpdates:BOOL];
Keep in mind that if location tracking is disabled, anything you set in here will have no effect since location tracking will be disabled globally for HyBid SDK
If you want to improve targeting, first configure the HyBidTargetingModel
object that you want to pass on and then invoke the following method:
Swift:
var targeting = HyBidTargetingModel()
targeting.age = <AGE>
targeting.interests = <ARRAY_OF_THE_INTERESTS>
targeting.gender = "<GENDER>" // "f" for female, "m" for male
HyBid.setTargeting(targeting)
Objective-C:
HyBidTargetingModel *targeting = [[HyBidTargetingModel alloc] init];
targeting.age = <AGE>;
targeting.interests = <ARRAY_OF_THE_INTERESTS>;
targeting.gender = "<GENDER>"; // "f" for female, "m" for male
[HyBid setTargeting:targeting];
You can control the level of log that you want to see in your console. As default HyBidLogger
is set to HyBidLogLevelInfo
. There are 5 HyBidLogLevels;
HyBidLogLevelNone
HyBidLogLevelError
HyBidLogLevelWarning
HyBidLogLevelInfo
HyBidLogLevelDebug
If you want to set a different HyBidLogLevel
in your app, the best place to do it, is before the HyBid initialization part.
Swift:
HyBidLogger.setLogLevel(HyBidLogLevelInfo)
Objective-C:
HyBidLogger setLogLevel:HyBidLogLevelInfo];