Unity SDK 集成 如果您想使用 Unity SDK 监测广告收入,可以借助 SDK 到 SDK 集成,将数据发送到 Adjust 服务器。 操作前须知 要使用该功能,请先为您的应用下载并设置对应的 Adjust iOS SDK。 要了解更多信息,请查看 Unity Mediation API和展示事件文档。 示例 1@interface ViewController()2 3@property(nonatomic, strong) UMSImpressionListenerWithBlocks * listener;4 5@end6 7@implementation ViewController8 9- (void) viewDidLoad {10 [super viewDidLoad];11 12 self.listener = [[UMSImpressionListenerWithBlocks alloc] init];13 self.listener.onImpressionBlock = ^ (NSString *adUnitId, UMSImpressionData *impressionData) {14 if (impressionData) {15 NSLog(@ "impressionData: %@", [impressionData getJsonRepresentation]);16 // send impression data to Adjust17 ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc]18 initWithSource:@"unity_sdk"];19 adjustAdRevenue.setRevenue([impressionData.revenue doubleValue], impressionData.currency);20 // optional fields21 adjustAdRevenue.setAdRevenueNetwork(impressionData.adSourceName);22 adjustAdRevenue.setAdRevenueUnit(impressionData.adUnitId);23 adjustAdRevenue.setAdRevenuePlacement(impressionData.adSourceInstance);24 // Send Adjust ad revenue25 Adjust.trackAdRevenue(adjustAdRevenue);26 } else {27 NSLog(@ "Data does not exist due to not enabling User-Level Reporting");28 }29 };30 [UMSImpressionEventPublisher subscribe: self.listener];31}32 33@end