Reach Ads SDK Sample for iOS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

###Getting Started

GMobi iOS Ads SDK (Go2ReachSDK), which includes Go2Reach.bundle Go2Reach.framework Put the SDK package in your iOS Project

Register your App in Go2Reach Ads platform and add the “Go2ReachADKey” key & value in the info.plist


Open sdk log

[GRServices debugMode:YES];

Banner Ad

  • Get the ad service instance
GRAdService* adService = [GRServices get:GR_SERVICE_TYPE_AD];
  • Create a banner ad with a preferred unique placement name
GRBannerAd* adTop = [adService getBannerAd:@""];

You could also get a specific size banner

GRBannerAd* adTop = [adService getBannerAd:@"banner.bottom" imageWidth:-1 imageHeight:60 requiredFields:nil]; // full width x 60pt
GRBannerAd* adTop = [adService getBannerAd:@"banner.bottom" imageWidth:320 imageHeight:60 requiredFields:nil]; // 320pt x 60pt
  • Create banner view and put it where you want the banner to display
UIView* banner = [adTop create];
[self.view addSubview:banner];

You could make it auto reload with specific interval

[adTop setReloadInterval:60]; // make the banner auto reload every 60 seconds

Interstitial Ad

  • Get the ad service instance
GRAdService* adService = [GRServices get:GR_SERVICE_TYPE_AD];
  • Create an interstitial ad with a preferred unique placement name
GRInterstitialAd* ad = [adService getInterstitialAd:@"intersitital.default"];

You could also customize the size. Display an interstitial ad as 300pt x 500pt in portrait mode and 500pt x 300pt in landscape mode

GRInterstitialAd* ad = [adService getInterstitialAd:@"intersitital.custom" portraitWidth:300 portraitHeight:500 landscapeWidth:500 landscapeHeight:300 requiredFields:nil];

Display an interstitial ad in full screen mode

GRInterstitialAd* ad = [adService getInterstitialAd:@"intersitital.fullscreen" portraitWidth:-1 portraitHeight:-1 landscapeWidth:-1 landscapeHeight:-1 requiredFields:nil]; 
  • Popup the interstitial ad
[ad popup];

Native Ad

  • Get the ad service instance
GRAdService* adService = [GRServices get:GR_SERVICE_TYPE_AD];
  • Create a native ad with a preferred unique placement name
GRNativeAd* nAd = [adService getNativeAd:@"native.default" preferredImageWidth:50 perferredImageHeight:50 count:1 requiredFields:nil];
// create 1 native ad with 50pt x 50pt preferred size image
  • Bind native ad elements with specific views
UIImageView* iconView = [[UIImageView alloc] init];
iconView.frame = CGRectMake(10, 175, 50, 50);
[self.view addSubview:iconView];
UILabel* titleLab = [[UILabel alloc] init];
titleLab.frame = CGRectMake(70, 175, sw - 150, 20);
[self.view addSubview:titleLab];

// Rateing view can used your own view class.  Just implement protocol "IGRRateView".
GRRateBar* starBar = [[GRRateBar alloc] initRateView:CGRectMake(70, 205, sw - 150, 20) maxStar:5 selStar:0];
[self.view addSubview:starBar];
UIButton* adACBtn = [[UIButton alloc] init];
adACBtn.frame = CGRectMake(sw-80, 175, 70, 50);
[adACBtn setFont:[UIFont systemFontOfSize:14.0]];
[adACBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[adACBtn setBackgroundColor:[UIColor greenColor]];
[self.view addSubview:adACBtn];

GRAdItem* nAdItem = [nAd getAdItem:0];
    if (nAdItem){
        NSMutableDictionary* views = [NSMutableDictionary dictionaryWithCapacity:1];
        [views setObject:iconView forKey:GR_AD_ITEM_ICON];
        [views setObject:titleLab forKey:GR_AD_ITEM_TITLE];
        [views setObject:adACBtn forKey:GR_AD_ITEM_CALL2ACTION];
        [views setObject:starBar forKey:GR_AD_ITEM_RATE];
        [nAdItem bind:views];
  • Load the ad and make it visible
[nAd load];