Integrate our light weight SDK into your brand new application in simple 2 step process!


Prerequisites


Integration of SDK


Manual Integration

Here is how you can install the Adcash iOS SDK manually following the few steps:

  1. Download the Adcash iOS SDK
  2. Unzip the archive.

  3. Right-click on your project in the Project Navigator menu install-instructions-2 and select Add Files to “name-of-your-project”…:

  4. Select the AdcashSDK folder you just extracted install-instructions-3 and press Add. Make sure to choose Copy items if needed.

  5. Add the -ObjC linker flag to your project by going install-instructions-4 to Build Settings > Other Linker Flags:

Build and Run. Your project should start without any errors.

CocoaPods Integration

Coming soon..

Implementation of Ads


Banner

Here is how you can easily integrate a banner into your app in just a few steps.

  1. Import AdcashSDK.h header file on top of your view controller’s file:
    #import "AdcashSDK.h"

  2. Set your view controller to conform to ADCBannerViewDelegate protocol:

        @interface ViewController : UIViewController <ADCBannerViewDelegate>
        @end
        

  3. Add the following code to the viewDidLoad: method of your view controller .m file:

        ADCBannerView *bannerView = [[ADCBannerView alloc] 
                          initWithZoneID:@"your_zone_id"
                      onViewController:self];
    
         // Do not translate autoresizing mask into constraints
         bannerView.translatesAutoresizingMaskIntoConstraints = NO;
           
         // Add your banner as a subview to your view
         [self.view addSubview:bannerView];
            
         // Add constraints to the banner
         // Set the banner take the width of it's parent view
         NSDictionary *views = NSDictionaryOfVariableBindings(bannerView);
    
         [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[bannerView]|"
        									  options:0
        								          metrics:nil
        								            views:views]];
    
         // Set the banner to stick to the bottom of it's parent
         [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[bannerView]|"
        								          options:0
        								          metrics:nil
            							            views:views]];
    
         // Set the banner's delegate to be your view controller
         bannerView.delegate = self;
            
         [bannerView load];
    
        

  4. (Optional) You can catch status updates from your banner by implementing the optional methods in ADCBannerViewDelegate protocol:

        - (void) bannerViewDidReceiveAd:(ADCBannerView *)bannerView;
        - (void) bannerView:(ADCBannerView *)bannerView didFailToReceiveAdWithError:(NSError *)error;
        - (void) bannerViewWillPresentScreen:(ADCBannerView *)bannerView;
        - (void) bannerViewWillLeaveApplication:(ADCBannerView *)bannerView;
        - (void) bannerViewWillDismissScreen:(ADCBannerView *)bannerView;
        

Interstitial

Here is how you can easily integrate an interstitial into your app in just a few steps.

  1. Import AdcashSDK.h header file on top of your view controller’s file:
    #import "AdcashSDK.h"

  2. Declare an interstitial property in your header file and make your view controller conform to the ADCInterstitialDelegate protocol. Your interface should look like this:

    	@interface ViewController : UIViewController <ADCInterstitialDelegate>
    	@property (nonatomic, strong) ADCInterstitial * interstitial;
    	@end
        

  3. Add the following code to the viewDidLoad: method of your view controller .m file:

    	// Assign an ADCInterstitial instance to your property.
    	self.interstitial = [[ADCInterstitial alloc] initWithZoneID:@"your_zone_id"];
    
    	// Make your view controller a delegate to the interstitial.
            self.interstitial.delegate = self;
        
            // Load the interstitial.
            [self.interstitial load];
        

  4. When the interstitial is loaded successfully, you can catch the status update and present it to the screen like the following:

    	- (void)interstitialDidReceiveAd:(ADCInterstitial *)interstitial
            {
    		[interstitial presentFromRootViewController:self];
            }
        

  5. (Optional) You can catch other status updates of your interstitial by implementing the optional methods in ADCInterstitialDelegate protocol:

    	- (void) interstitialDidReceiveAd:(ADCInterstitial *)interstitial;
    	- (void) interstitial:(ADCInterstitial *)interstitial didFailToReceiveAdWithError:(NSError *)error;
    	- (void) interstitialWillPresentScreen:(ADCInterstitial *)interstitial;
    	- (void) interstitialWillDismissScreen:(ADCInterstitial *)interstitial;
    	- (void) interstitialWillLeaveApplication:(ADCInterstitial *)interstitial;
        

Rewarded

Rewarded Video is a high performing Ad-Format which provide capability to integrate Un-Skippable Video ads into your App and incentivizes user with In-App virtual currency (Coins, Life etc.) for watching Un-Skippable video ad.

Here is how you can easily integrate an rewarded video into your app in just a few steps.

  1. Import AdcashSDK.h header file on top of your view controller’s file:
    #import "AdcashSDK.h"

  2. Declare a rewarded property in your header file and make your view controller conform to the AdcashRewardedVideoDelegate protocol. Your interface should look like this;

    	@interface ViewController : UIViewController <AdcashRewardedVideoDelegate>
    	@property (nonatomic, strong) AdcashRewardedVideo * video;
    	@end
        

  3. To load the video, call:

            self.video = [AdcashRewardedVideo alloc] initRewardedVideoWithZoneID:@"your_zone_id"];
            self.video.delegate = self;
        

  4. To play the video, call:

           [self.video playRewardedVideoFrom:self];
        
    
        -(void)rewardedVideoDidReceiveAd:(AdcashRewardedVideo *)rewardedVideo
        {
            [self.video playRewardedVideoFrom:self];
        }
        

  5. To use ad events:

    Required

        -(void)rewardedVideoDidComplete:(AdcashRewardedVideo *)rewardedVideo withReward:(int)reward;
        

    This method is called when user completed watching rewarded video and it’s time to reward the user.

    
        -(void)rewardedVideoDidComplete:(AdcashRewardedVideo *)rewardedVideo withReward:(int)reward
          {
            user.coins += reward;
            //or you can disregard "reward" value and use your own, if you have other algorithms
            //to reward the user.
          }
        

    Optional

        -(void)rewardedVideoDidReceiveAd:(AdcashRewardedVideo *)rewardedVideo;
        -(void)rewardedVideoDidFailToReceiveAd:(AdcashRewardedVideo *)rewardedVideo withError:(NSError *)error;
        -(void)rewardedVideoWillPresentScreen:(AdcashRewardedVideo *)rewardedVideo;
        -(void)rewardedVideoWillDismissScreen:(AdcashRewardedVideo *)rewardedVideo;
        -(void)rewardedVideoDidDismissScreen:(AdcashRewardedVideo *)rewardedVideo;
        -(void)rewardedVideoWillLeaveApplication:(AdcashRewardedVideo *)rewardedVideo;
        

Native

Native is an ad format that is rendered by the publisher, allowing them to give users a unique experience with finely tuned look and design.

Here is how you can easily integrate a native ad into your app in just a few steps.

  1. Import AdcashSDK.h header file on top of your view controller’s file:
    #import "AdcashSDK.h"

  2. Declare a native ad property in your header file and make your view controller conform to the AdcashNativeDelegate protocol. Your interface should look like this;

    	@interface ViewController : UIViewController <AdcashNativeDelegate>
    	@property (nonatomic, strong) AdcashNative *native;
    	@end
        

  3. To load the native ad, call:

            self.native = [AdcashNative alloc] initAdcashNativeWithZoneID:@"your_zone_id"];
            self.native.delegate = self;
        

  4. After loading, if response is successful, native instance is filled with information about the ad, that contains :

    Title
    Description
    Rating
    Icon
    Image
    Action button text

    to get these values, you should use provided functions below :

        -(NSString *)getAdTitle;
        -(NSString *)getAdDescription;
        -(NSString *)getAdRating;
        -(NSURL *)getAdIcon;
        -(NSURL *)getAdImage;
        -(NSString *)getAdButtonText;
        

  5. To use ad events:

        -(void)AdcashNativeAdReceived:(AdcashNative *)native;
        -(void)AdcashNativeFailedToReceiveAd:(AdcashNative *)native withError:(NSError *)error;
        

  6. You should also handle clicks and impressions so monetization won’t get affected.

    Call function below, when Ad is visible on the screen;

    
        -(void)trackImpression;
    
        

    To handle clicks call;

    
        -(void)openClick
    
        

For detailed implementation and examples, check the Example Project.


App Transport Security (ATS)


Click for detailed information
With the release of iOS 9, Apple introduced a new default setting, called App Transport Security (ATS). ATS requires apps to make network connections only over SSL. It also allows specific encryption ciphers, SSL version and key length to be used when creating HTTPS connections.

Therefore, all iOS 9 devices running apps built with Xcode 7 that don’t disable ATS will be affected by this change. When a non-ATS compliant app attempts to serve an ad via HTTP on iOS 9, the following log message appears:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.

While Adcash acknowledges the need for secure connections, our ad network is not ready yet with the compliance of the requirements. Therefore, Adcash iOS SDK will work only by disabling App Transport Security in your `Info.plist`. You can do so by using one of the following two ways depending on your preference:

Disable ATS

Disable ATS for all domains

This is the easiest solution. The only thing you need to do is to add the following configuration in your Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

It should look like this:

Disable ATS for all domains

Disable ATS with some exceptions

Disable ATS for all domains, with some exceptions

Click for detailed information
You may only want ATS to work on domains you specifically know can support it. For example, if you may know that your server supports ATS and you would want things like login calls, and other requests to your server to use ATS, but ad requests to Adcash to bypass ATS requirements.

In this case you should set `NSAllowsArbitraryLoads` to true, then define the URLs that you want to be secure in your `NSExceptionDomains` dictionary. Each domain you wish to be secure should have its own dictionary, and the `NSExceptionAllowsInsecureHTTPLoads` for that dictionary should be set to false.

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
	<key>NSExceptionDomains</key>
	<dict>
		<key>secure.yourdomain.com</key>
		<dict>
			<key>NSExceptionAllowsInsecureHTTPLoads</key>
			<false/>
		</dict>
	</dict>
</dict>

It should look like this:
Disable ATS for all domains with exceptions

If you do not follow the above instructions for apps built on XCode 7, monetization will be severely impacted as some connections might fail resulting in the ads not rendering.

Support

If you need any help or assistance you can contact us by sending email to mobile@adcash.com.