查看客户端升级
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在 v4 版本中,客户端 tvOS SDK 的变化非常小。主要变化是添加了 IMAAdDisplayContainer
,如 iOS SDK 中所示。
本指南将逐步介绍将现有 v3 实现升级到新的 v4 SDK 所需的流程。
更改模块名称
为了与 iOS SDK 保持一致,我们已将模块名称从 ClientSideInteractiveMediaAds
更改为 GoogleInteractiveMediaAds
,因此您应进行以下更改。
变更 |
旧优惠 |
#import <ClientSideInteractiveMediaAds/ClientSideInteractiveMediaAds.h>
@import ClientSideInteractiveMediaAds;
|
新 |
#import <GoogleInteractiveMediaAds/GoogleInteractiveMediaAds.h>
@import GoogleInteractiveMediaAds;
|
创建新的广告容器
创建并传入 IMAAdDisplayContainer |
旧优惠 |
IMAAdsRequest *adsRequest =
[[IMAAdsRequest alloc] initWithAdTagUrl:kAdTagUrlString
adDisplayContainer:self.videoView
contentPlayhead:self.contentPlayhead
userContext:userContext];
|
新 |
self.adDisplayContainer =
[[IMAAdDisplayContainer alloc] initWithAdContainer:self.videoView];
IMAAdsRequest *adsRequest =
[[IMAAdsRequest alloc] initWithAdTagUrl:kAdTagUrlString
adDisplayContainer:self.adDisplayContainer
contentPlayhead:self.contentPlayhead
userContext:userContext];
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-01。
[null,null,["最后更新时间 (UTC):2025-08-01。"],[[["\u003cp\u003eThe tvOS SDK v4 introduces \u003ccode\u003eIMAAdDisplayContainer\u003c/code\u003e, aligning it with the iOS SDK.\u003c/p\u003e\n"],["\u003cp\u003eUpgrading from v3 involves changing the module name from \u003ccode\u003eClientSideInteractiveMediaAds\u003c/code\u003e to \u003ccode\u003eGoogleInteractiveMediaAds\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou must now create and utilize an \u003ccode\u003eIMAAdDisplayContainer\u003c/code\u003e when making ad requests.\u003c/p\u003e\n"]]],[],null,["# Review client-side upgrade\n\nThe Client-side tvOS SDK has changed very little with the v4 release. The\nprimary change is the addition of `IMAAdDisplayContainer`, as seen in the iOS\nSDK.\n\nThis guide walks through the process required to upgrade an existing v3\nimplementation to the new v4 SDK.\n\nChange the module name\n----------------------\n\nTo match the iOS SDK, we've changed the module name from\n`ClientSideInteractiveMediaAds` to `GoogleInteractiveMediaAds`, so you should\nmake the following changes.\n\n| Changes ||\n|-----|--------------------------------------------------------------------------------------------------------------------------------------------|\n| Old | ```python #import \u003cClientSideInteractiveMediaAds/ClientSideInteractiveMediaAds.h\u003e ``` ```python @import ClientSideInteractiveMediaAds; ``` |\n| New | ```python #import \u003cGoogleInteractiveMediaAds/GoogleInteractiveMediaAds.h\u003e ``` ```python @import GoogleInteractiveMediaAds; ``` |\n\nCreate the new ad container\n---------------------------\n\n| Create and pass in an IMAAdDisplayContainer ||\n|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Old | ```objective-c IMAAdsRequest *adsRequest = [[IMAAdsRequest alloc] initWithAdTagUrl:kAdTagUrlString adDisplayContainer:self.videoView contentPlayhead:self.contentPlayhead userContext:userContext]; ``` |\n| New | ```objective-c self.adDisplayContainer = [[IMAAdDisplayContainer alloc] initWithAdContainer:self.videoView]; IMAAdsRequest *adsRequest = [[IMAAdsRequest alloc] initWithAdTagUrl:kAdTagUrlString adDisplayContainer:self.adDisplayContainer contentPlayhead:self.contentPlayhead userContext:userContext]; ``` |"]]