Size in dpi | Type | Size Constant |
---|---|---|
320x50 | Standard Banner | kStandartSizeBanner |
320x100 | Large Banner | kLargeSizeBanner |
300x250 | IAB Medium Rectangle | kIABMediumRectangelSizeBanner |
468x60 | IAB Full-Size Banner | kIABFullSizeBanner |
728x90 | IAB Leaderboard | kIABLeaderboardSizeBanner |
Contact us at contact@silvermob.com and we help you with setting up an account.
Edit your Info.plist file to include the following properties: * Add ADBundleIsPaid property and its Boolean value: - YES - if your App is paid, or you have in-app purchases - NO - if your App is distributed free of any charges
To allow SilverMobAdsSDK geo ad targeting: Add Privacy - Location When In Use Usage Description property with a String value:your_app_name would like to use your geoposition
<?xml version="1.0" encoding="utf-8"?>
<!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>NSLocationWhenInUseUsageDescription</key>
<string>your_app_name would like to use your geoposition</string>
...
</dict>
</plist>
TURN ON App Transport Security - Allows Arbitrary Loads property - this option will allow ad content loading via HTTPprotocol. In order to turn turn on this property do the following:
<?xml version="1.0" encoding="utf-8"?>
<!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
...
</dict>
</plist>
ALTERNATIVELY, you can use App Transport Security - Allows Arbitrary Loads In Web Content property - this option will allow web content loading via HTTP protocol. Also add ssp-nj.webtradehub.com to Exception Domains dictionary:
<?xml version="1.0" encoding="utf-8"?>
<!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>ssp-nj.webtradehub.com</key>
<dict/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
...
</dict>
</plist>
In AppDelegate.m, -application:didFinishLaunchingWithOptions: method add following initializing code:
#import <SilverMobAdsSDK/SilverMobAdsSDK.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[MonetizationSDK start];
[MonetizationSDK GDPRconsentFlag:YES];
return YES;
}
+ (void)GDPRconsentFlag:(BOOL)flag; - set a new value for GDPR user consent. GDPR user consent is a boolean value, where YES = user consent given & NO = user consent denied or no information provided.
+ (BOOL)getGDPRconsentFlag; - get current GDPR value
In View/ ViewController where you want to show Banner, add BannerAdView property as a class var:
#import <SilverMobAdsSDK/SilverMobAdsSDK.h>
@interface ViewController ()<BannerAdViewDelegate>
@property (nonatomic, strong) BannerAdView *adview;
@end
Use -init, -initWithFrame:, or -viewDidLoad as a place for adView initialization:
- (instancetype)init {
self = [super init];
self.adView = [[BannerAdView alloc] initWithPlacementId:**your_banner_id_here** size:**your_banner_size_here**];
self.adView.delegate = self;
[self.view addsubview:self.adview];
return self;
}
In order to load Banner AD, you should call -loadBannerAd method. Load should be called when view is already shown, so we are sure that ad will be shown to the actual user. The most optimal place is -viewWillAppear method:
- (void)viewWillAppear {
[super viewWillAppear];
[self.adView loadBannerAd];
}
For shows Banner Ad View just call -showBannerAdView method.
- (void)bannerAdDidLoad {
[self.adView showBannerAdView];
}
BannerAdView serves the following methods for Ad View management:
-loadBannerAd
- loads Banner Ad from server
-showBannerAdView
- shows Banner Ad View
-startAutomaticallyRefreshingContents
- starts refreshing Ad View periodically. Minimal refresh interval is 30 seconds. You can set new interval in method -autoRefreshInterval
-stopAutomaticallyRefreshingContents
- stops previously initiated auto refresh process
Required methods:
-bannerAdDidLoad
- fires when Banner AD is successfully loaded and ready for showing
-bannerAdDidFailLoadingWithError
: - fires when Banner Ad failed to load from server
-viewControllerForPresentingModalView
- the BannerAdView will use the view controller returned by this method to present modals when tapped. Typically your controller can simply return self.
-bannerAdCacheDidFailLoadingWithError
: - fires when Banner Ad failed to load from local cache
Optional methods:
-bannerAdViewClicked
- fires when user clicked on Banner Ad View
-shouldRequestPreciseLocation
- asks if Ad View can request geo location, by using device location services, YES by default
-autoRefreshInterval
- method for overriding time interval for auto refreshing