Paijin SDK access document

1. Access SDK
1. Manually import the sdk file into the target project, as shown in the figure below:
Please add a picture description
2. The SDK needs to be connected to other third-party advertisements through pod. Add the following code to the Profile:

 pod 'GDTMobSDK', '~> 4.14.40'
  pod 'BaiduMobAdSDK', '~> 5.313'
  pod 'KSAdSDK', '~> 3.3.51.1'

3. The version number of the third-party library in ② that the SDK depends on is inconsistent with the version number of the library that exists in your project. Please adapt or contact the SDK developer for adaptation.
4. The SDK does not have to rely on the third-party libraries in ②. If you do not need the resources of an advertiser, please contact the developer for development.

2. Code access
1. Initialization

//Import project header file
#import <MTAd/MTAd.h>
// Initialization method, token refers to the token provided by the operator and bound to the bundle id of the access party.
[MTAdApi initXWAdWithToken:@"token"];
//Get the current sdk version number
NSLog(@"=========%@",[MTAdApi MT_version]);

2. Server-side bidding related data

//The key-value content of the reported content is as follows
typedef NS_ENUM(NSUInteger, BidPriceKey) {<!-- -->
    /** Key representing the price of the winning party */
    KEY_WIN_EXPECT_COST_PRICE = 1,
    /** The key that represents the maximum price of the loser when winning the competition */
    KEY_HIGHEST_LOSS_PRICE = 2,
    /** Represents the bidding reason when the winner or loser is the winner. Its valut value can be: 0. Others, 1. Insufficient competitiveness, 2. No advertisement returned, 3. Not participating in the bidding) */
    KEY_FAILED_REASON = 3,
    /** Represents the losing advertiser, its value can be (0, other channels, 1, Guangdian Tong, 2, Baiqingteng, 3, Pangolin, 4, Kuaishou, 5, Jingzhuntong, 10, Π金engine) */
    KEY_ADN_TYPE = 4,
    /** Win or lose? Channel name */
    KEY_ADN_NAME = 5,
    
    /**
       * Called after winning the competition, need to be called before calling ad show
       *
       * @param params - required, where
       * The corresponding value of the key KEY_EXPECT_COST_PRICE is the winning bid (unit: points), the type is Int, optional;
       * The corresponding value of the key KEY_HIGHEST_LOSS_PRICE is the maximum loser's bid (unit: points), the type is Int, optional.
       */
};

//After obtaining the bidding information, you will get a model information as follows
@interface PRXServerBidingModel : NSObject

/** Jingsheng token */
@property (nonatomic,copy) NSString * token;

/** Jingsheng price */
@property (nonatomic,copy) NSString * price;

/** Jingsheng reporting url */
@property (nonatomic,copy) NSString * nurl;

/** Competition failure reporting url */
@property (nonatomic,copy) NSString * lurl;

/**  error code */
@property (nonatomic,copy) NSString * errorCode;


@end

3. Open screen advertising access method

//Initialize the screen opening advertising object
[[MTSplashObject alloc] initWithPlacementId:@"advertising slot id"];
//Comply with the proxy of the open-screen advertising object. For proxy details, see <MTSplashObjectDelegate>
xxx.delegate = self;
// Get bidding information --- Applicable to server-side bidding
[xxx getBidingInfoResult];
// After obtaining the bidding information, the media will receive the following agent (please sign a delegate in advance)
- (void)mt_splashbidEnd:(MTSplashObject *)splashAd info:(PRXServerBidingModel *)info{<!-- -->
    NSLog(@"2 SplashAd bidding successful----->%s,error = %@ -- info-%@",__func__,splashAd,info);
}
//Server-side bidding loading advertising method
[xxx bidLoadAd];
//Normal mode loading advertising method
[xxx loadAd];
/**
 * Screen-opening creatives are loaded successfully
 */
- (void)mt_splashAdDidLoad:(MTSplashObject * __nullable)splashAd{<!-- -->
    NSLog(@"2 screen opening creative is loaded successfully----->%s,error = %@",__func__,splashAd);
}

/**
 * Failed to display open-screen ads
 */
- (void)mt_splashAdFailToPresent:(MTSplashObject * __nullable)splashAd withError:(NSError *)error{<!-- -->
    NSLog(@"3 Failed to display open-screen advertisement----->%s,error = %@",__func__,error);
}

//The ad can only be displayed after the ad is loaded successfully.
//Support custom view at the bottom of the open screen advertisement
//Support open-screen advertising custom skip button
[xxx showAdInWindow:windoww withBottomView:nil skipView:nil];
//After obtaining the bidding results for the advertising resources provided by the SDK, please call the following code to report
/**
 Report of successful bidding
 */
- (void)sendBidPriceWin:(NSDictionary *_Nullable)winInfo;

/**
 Reporting of failed bidding
 */
- (void)sendBidPriceLoss:(NSDictionary *_Nullable)lossInfo;

Other proxy methods

/**
 * Called when the application enters the background
 * Detailed explanation: When you click to download an application, the system program will be called to open and the application will switch to the background.
 */
- (void)mt_splashAdApplicationWillEnterBackground:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"4Callback when the application enters the background----->%s",__func__);

}

/**
 * Open screen ad exposure callback
 */
- (void)mt_splashAdExposured:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"5 open screen ad exposure callback----->%s",__func__);

}

/**
 *Click callback for opening screen advertisement
 */
- (void)mt_splashAdClicked:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"6 open screen ad click callback----->%s",__func__);

}

/**
 * Open screen advertisement will be closed callback
 */
- (void)mt_splashAdWillClosed:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"7 open screen advertisement will be closed callback----->%s",__func__);

}

/**
 * Open screen ad closing callback
 */
- (void)mt_splashAdClosed:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"8 open screen ad closing callback----->%s",__func__);
}

- (void)mt_splashAdClickSkip:(MTSplashObject *)splashAd
{<!-- -->
    NSLog(@"9 clicked the skip button");
}

/**
 * After clicking on the open-screen advertisement, a full-screen advertisement page will pop up
 */
- (void)mt_splashAdWillPresentFullScreenModal:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"After clicking on the 10-screen advertisement, a full-screen advertisement page will pop up----->%s",__func__);

}

/**
 * After clicking on the open-screen advertisement, a full-screen advertisement page will pop up
 */
- (void)mt_splashAdDidPresentFullScreenModal:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"After clicking on the 11 open-screen advertisement, a full-screen advertisement page will pop up----->%s",__func__);

}

/**
 * After clicking, the full-screen advertising page will be closed.
 */
- (void)mt_splashAdWillDismissFullScreenModal:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"The full-screen advertising page will be closed after 12 clicks----->%s",__func__);

}

/**
 * The full-screen advertising page has been closed after clicking
 */
- (void)mt_splashAdDidDismissFullScreenModal:(MTSplashObject * __nullable)splashAd
{<!-- -->
    NSLog(@"The full-screen advertising page has been closed after 13 clicks----->%s",__func__);

}

/**
 * Callback for the remaining time of the open-screen advertisement
 */
- (void)mt_splashAdLifeTime:(NSUInteger)time splashAd:(MTSplashObject * _Nullable)splashAd
{<!-- -->
    NSLog(@"Callback for remaining time of 14 open screen ads----->%s",__func__);

}

4. Incentive video access method

//Incentive video initialization
xxx = [[MTRewardVideoAd alloc] initWithPlacementId:@"advertising space"];
// Sign proxy and comply with proxy <MTRewardVideoAdDelegate>
xxx.delegate = self;
//Server-side bidding --- Get bidding information
[xxx getBidingInfoResult];

//After receiving the bidding information
- (void)mt_rewardVideoBidEnd:(MTRewardVideoAd *)rewardedVideoAd info:(PRXServerBidingModel *)info{<!-- -->
    self.statusLabel.text = @"Bidding successful";
}
//Server-side bidding method -- loading ads
[xxx bidLoadAd];
//Normal mode --- Load ads
[xxx loadAd];


/**
 Advertising data loading success callback

 @param rewardedVideoAd MTRewardVideoAd instance
 */
- (void)mt_rewardVideoAdDidLoad:(MTRewardVideoAd *)rewardedVideoAd
{<!-- -->
    self.statusLabel.text = @"Advertising data loaded successfully";
}

/**
 Various error message callbacks for video ads

 @param rewardedVideoAd MTRewardVideoAd instance
 @param error specific error information
 */
- (void)mt_rewardVideoAd:(MTRewardVideoAd *)rewardedVideoAd didFailWithError:(NSError *)error
{<!-- -->
    NSLog(@"%s",__FUNCTION__);
      if (error.code == 4014) {<!-- -->
          NSLog(@"Please fetch the advertisement before calling the display interface");
          self.statusLabel.text = @"Please fetch the advertisement before calling the display interface";
      } else if (error.code == 4016) {<!-- -->
          NSLog(@"The application direction is inconsistent with the direction supported by the ad slot");
          self.statusLabel.text = @"The application direction is inconsistent with the direction supported by the advertising slot";
      } else if (error.code == 5012) {<!-- -->
          NSLog(@"Ad has expired");
          self.statusLabel.text = @"Advertisement has expired";
      } else if (error.code == 4015) {<!-- -->
          NSLog(@"The ad has been played, please pull it again");
          self.statusLabel.text = @"The ad has been played, please pull it again";
      } else if (error.code == 5002) {<!-- -->
          NSLog(@"Video download failed");
          self.statusLabel.text = @"Video download failed";
      } else if (error.code == 5003) {<!-- -->
          NSLog(@"Video playback failed");
          self.statusLabel.text = @"Video playback failed";
      } else if (error.code == 5004) {<!-- -->
          NSLog(@"No suitable advertisement");
          self.statusLabel.text = @"No suitable advertisement";
      } else if (error.code == 5013) {<!-- -->
          NSLog(@"The request is too frequent, please try again later");
          self.statusLabel.text = @"The request is too frequent, please try again later";
      } else if (error.code == 3002) {<!-- -->
          NSLog(@"Network connection timeout");
          self.statusLabel.text = @"Network connection timeout";
      }
      NSLog(@"ERROR: %@", error);
}
//After the video is loaded successfully, the incentive video will be displayed. Note that the controller cannot be empty.
[xxx showAdFromRootViewController:controller];

Reporting method based on SDK bidding success or failure

/**
 Report of successful bidding
 */
- (void)sendBidPriceWin:(NSDictionary *_Nullable)winInfo;

/**
 Reporting of failed bidding
 */
- (void)sendBidPriceLoss:(NSDictionary *_Nullable)lossInfo;

Other proxy methods

/**
 The video playback page is about to display a callback

 @param rewardedVideoAd MTRewardVideoAd instance
 */
- (void)mt_rewardVideoAdWillVisible:(MTRewardVideoAd *)rewardedVideoAd
{<!-- -->
    
}

/**
 Video ad exposure callback

 @param rewardedVideoAd MTRewardVideoAd instance
 */
- (void)mt_rewardVideoAdDidExposed:(MTRewardVideoAd *)rewardedVideoAd
{<!-- -->
    self.statusLabel.text = @"Advertising has been exposed";

}

/**
 Video playback page close callback

 @param rewardedVideoAd MTRewardVideoAd instance
 */
- (void)mt_rewardVideoAdDidClose:(MTRewardVideoAd *)rewardedVideoAd
{<!-- -->
    self.statusLabel.text = @"Advertising has been closed";

}

/**
 Video advertising information click callback

 @param rewardedVideoAd MTRewardVideoAd instance
 */
- (void)mt_rewardVideoAdDidClicked:(MTRewardVideoAd *)rewardedVideoAd
{<!-- -->
    self.statusLabel.text = @"Ad has been clicked";
}

/**
 Callback when video ad playback reaches incentive conditions

 @param rewardedVideoAd MTRewardVideoAd instance
 */
- (void)mt_rewardVideoAdDidRewardEffective:(MTRewardVideoAd *)rewardedVideoAd
{<!-- -->
    NSLog(@"Playback reaches incentive conditions");

}

/**
 Video ad video playback completed

 @param rewardedVideoAd MTRewardVideoAd instance
 */
- (void)mt_rewardVideoAdDidPlayFinish:(MTRewardVideoAd *)rewardedVideoAd
{<!-- -->
    NSLog(@"Video playback ends");
    self.statusLabel.text = @"Video playback ends";


}

5. Interstitial advertising access method

//Interstitial advertising object initialization method
xxx = [[MTInterstitialAd alloc] initWithPlacementId:@"code bit"];
// Comply with delegate <MTInterstitialAdDelegate>
xxx.delegate = self;
//Server-side bidding to obtain bidding information
[xxx getBidingInfoResult];

//Get bidding information, obtained data, callback information
- (void)mt_unifiedInterstitialBidEnd:(MTInterstitialAd *)splashAd info:(PRXServerBidingModel *)info {<!-- -->
    self.statusLabel.text = @"Bidding data request successful";
}
//Server-side bidding method -- loading ads
[xxx bidLoadAd];
//Normal mode --- Load ads
[xxx loadAd]

// Callback for loading results
/**
 * Ad preloading success callback
 * Detailed explanation: This function is called when the advertising data returned by the server is successfully received and preloaded.
 */
- (void)mt_unifiedInterstitialSuccessToLoadAd:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    self.statusLabel.text = @"Advertising data request successful";
}

/**
 * Ad preloading failure callback
 * Detailed explanation: This function is called when receiving the advertising data returned by the server fails.
 */
- (void)mt_unifiedInterstitialFailToLoadAd:(MTInterstitialAd *)interstitialAd error:(NSError *)error
{<!-- -->
    self.statusLabel.text = @"Advertising data loading failed";
}
// After the ad is loaded successfully, the display screen controller cannot be empty.
[xxx presentAdFromRootViewController:controller];

Bidding results reporting method

/**
 Report of successful bidding
 */
- (void)sendBidPriceWin:(NSDictionary *_Nullable)winInfo;

/**
 Reporting of failed bidding
 */
- (void)sendBidPriceLoss:(NSDictionary *_Nullable)lossInfo;

Other proxy callback methods

/**
 * Ad preloading success callback
 * Detailed explanation: This function is called when the advertising data returned by the server is successfully received and preloaded.
 */
- (void)mt_unifiedInterstitialSuccessToLoadAd:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    self.statusLabel.text = @"Advertising data request successful";
    NSLog(@"%s,%@",__func__,self);
}

/**
 * Ad preloading failure callback
 * Detailed explanation: This function is called when receiving the advertising data returned by the server fails.
 */
- (void)mt_unifiedInterstitialFailToLoadAd:(MTInterstitialAd *)interstitialAd error:(NSError *)error
{<!-- -->
    self.statusLabel.text = @"Advertising data loading failed";
    NSLog(@"%s,%@",__func__,self);
    NSLog(@"error==%@",error.description);


}

/**
 * Interstitial ads will be displayed callback
 * Detailed explanation: This function is called back when the interstitial ad is about to be displayed.
 */
- (void)mt_unifiedInterstitialWillPresentScreen:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);

}

/**
 * Interstitial ad view display successful callback
 * Detailed explanation: This function is called back when the interstitial ad is displayed successfully.
 */
- (void)mt_unifiedInterstitialDidPresentScreen:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);

}

/**
 * Interstitial ad display end callback
 * Detailed explanation: This function is called back when the interstitial ad display ends
 */
- (void)mt_unifiedInterstitialDidDismissScreen:(MTInterstitialAd *)interstitialAd
{<!-- -->
    self.statusLabel.text = @"Interstitial ad display end callback";
    NSLog(@"%s,%@",__func__,self);
}

/**
 * Detailed explanation: Called when an application is clicked to download or an ad-calling system program is opened.
 */
- (void)mt_interstitialApplicationWillEnterBackground:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);
    
}

/**
 * Interstitial ad exposure callback
 */
- (void)mt_interstitialWillExposure:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);

}


/**
 * Interstitial ad click callback
 */

- (void)mt_unifiedInterstitialClicked:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);
    self.statusLabel.text = @"Interstitial ad click callback";

}

/**
 * After clicking on the interstitial ad, a full-screen ad page will pop up
 */
- (void)mt_unifiedInterstitialAdWillPresentFullScreenModal:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);

}

/**
 * After clicking on the interstitial ad, a full-screen ad page will pop up
 */
- (void)mt_unifiedInterstitialAdDidPresentFullScreenModal:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);

}

/**
 * The full screen advertising page will be closed
 */
- (void)mt_unifiedInterstitialAdWillDismissFullScreenModal:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);

}

/**
 * Full screen advertising page is closed
 */
- (void)mt_unifiedInterstitialAdDidDismissFullScreenModal:(MTInterstitialAd *)interstitialAd
{<!-- -->
    NSLog(@"%s,%@",__func__,self);
    self.statusLabel.text = @"The full-screen advertising page is closed";

}
/**
 * When you click to download an application, the system program will be called to open other apps or callback when the Appstore is opened.
 */
- (void)mt_unifiedInterstitialWillLeaveApplication:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    NSLog(@"%s,%@",__func__,self);
}

/**
 * Interstitial ad exposure callback
 */
- (void)mt_unifiedInterstitialWillExposure:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    NSLog(@"%s,%@",__func__,self);
    self.statusLabel.text = @"Interstitial ad exposure callback";

}

/**
 * Interstitial video ad player playback status update callback
 */
- (void)mt_unifiedInterstitialAd:(MTInterstitialAd *)unifiedInterstitial playerStatusChanged:(MTMediaPlayerStatus)status{<!-- -->
    NSLog(@"%s,%@",__func__,self);
}

/**
 * WillPresent callback for interstitial video ad details page
 */
- (void)mt_unifiedInterstitialAdViewWillPresentVideoVC:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    NSLog(@"%s,%@",__func__,self);
}

/**
 * DidPresent callback of interstitial video ad details page
 */
- (void)mt_unifiedInterstitialAdViewDidPresentVideoVC:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    NSLog(@"%s,%@",__func__,self);
}

/**
 * WillDismiss callback of interstitial video ad details page
 */
- (void)mt_unifiedInterstitialAdViewWillDismissVideoVC:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    NSLog(@"%s,%@",__func__,self);
}

/**
 * DidDismiss callback of interstitial video ad details page
 */
- (void)mt_unifiedInterstitialAdViewDidDismissVideoVC:(MTInterstitialAd *)unifiedInterstitial{<!-- -->
    NSLog(@"%s,%@",__func__,self);
}

6. Information flow advertising access method

//Information flow object initialization method -- the server-side bidding method must be initialized in this way
xxx = [[MTUnifiedNativeAd alloc] initWithPlacementId:@"advertising space"];
    [self.unifiedNativeAd getBidingInfoResultWithCount:1];
// Information flow proxy complies with <MTUnifiedNativeAdDelegate,MTUnifiedNativeAdViewDelegate,MTMediaViewDelegate>
xxx.delegate = self;
// Get bidding information -- pass in the expected number of information flows
[xxx getBidingInfoResultWithCount:1];

- (void)mt_unifiedNativeBid:(MTUnifiedNativeAd *)object bidInfo:(PRXServerBidingModel *)info {<!-- -->
    NSLog(@"Information flow bidding successful");
}
// In normal mode, load advertising method
[self.unifiedNativeAd loadAdWithAdCount:1];
//Server-side bidding method, load ads
[xxx bidLoadAd];


// Get the advertising resources after successful loading, or the information after failure
- (void)mt_unifiedNativeAdLoaded:(NSArray<MTUnifiedNativeAdObject *> *)unifiedNativeAdDataObjects error:(NSError *)error
{<!-- -->
    if (unifiedNativeAdDataObjects.count > 0) {<!-- -->
    }
    NSLog(@"error = %@",error);
}
//After obtaining the bidding results for the advertising resources provided by the SDK, please call the following code to report
/**
 Report of successful bidding
 */
- (void)sendBidPriceWin:(NSDictionary *_Nullable)winInfo;

/**
 Reporting of failed bidding
 */
- (void)sendBidPriceLoss:(NSDictionary *_Nullable)lossInfo;

Other proxy methods

/**
 Ad exposure callback

 @param unifiedNativeAdView MTUnifiedNativeAdView instance
 */
- (void)mt_unifiedNativeAdViewWillExpose:(MTUnifiedNativeAdView *)unifiedNativeAdView
{<!-- -->
    NSLog(@"XW exposure callback");
    

}


/**
 Ad click callback

 @param unifiedNativeAdView MTUnifiedNativeAdView instance
 */
- (void)mt_unifiedNativeAdViewDidClick:(MTUnifiedNativeAdView *)unifiedNativeAdView
{<!-- -->
    NSLog(@"XW click callback");

}


/**
 Ad details page close callback

 @param unifiedNativeAdView MTUnifiedNativeAdView instance
 */
- (void)mt_unifiedNativeAdDetailViewClosed:(MTUnifiedNativeAdView *)unifiedNativeAdView
{<!-- -->
    NSLog(@"XW ad details page close callback");

}


/**
 Called when an app is clicked to download or an ad-calling system program is opened
 
 @param unifiedNativeAdView MTUnifiedNativeAdView instance
 */
- (void)mt_unifiedNativeAdViewApplicationWillEnterBackground:(MTUnifiedNativeAdView *)unifiedNativeAdView
{<!-- -->
    NSLog(@"XW");

}


/**
 The ad details page is about to display callback

 @param unifiedNativeAdView MTUnifiedNativeAdView instance
 */
- (void)mt_unifiedNativeAdDetailViewWillPresentScreen:(MTUnifiedNativeAdView *)unifiedNativeAdView
{<!-- -->
    NSLog(@"XW ad details page is about to be displayed callback");

}


/**
 Video ad playback status change callback

 @param unifiedNativeAdView instance
 @param status video ad playback status
 @param userInfo video advertising information
 */
- (void)mt_unifiedNativeAdView:(MTUnifiedNativeAdView *)unifiedNativeAdView playerStatusChanged:(MTMediaPlayerStatus)status userInfo:(NSDictionary *)userInfo
{<!-- -->
    NSLog(@"");
    NSLog(@"Video ad status change");
      switch (status) {<!-- -->
          case MTMediaPlayerStatusError:
              NSLog(@"Video playback error");
              //Developers can add logic here
          default:
              break;
      }

}

- (void)mt_mediaViewDidTapped:(MTMediaView *)mediaView{<!-- -->
    NSLog(@"mt_mediaViewDidTapped");
}

/**
 Playback complete callback

 @param mediaView player instance
 */
- (void)mt_mediaViewDidPlayFinished:(MTMediaView *)mediaView{<!-- -->
    NSLog(@"mt_mediaViewDidPlayFinished");
}