有关应用内广告的已知问题和疑难解答Known issues and troubleshooting for ads in apps

警告

从2020年6月1日起,将关闭适用于 Windows UWP 应用的 Microsoft Ad 盈利平台。As of June 1, 2020, the Microsoft Ad Monetization platform for Windows UWP apps will be shut down. 了解详细信息Learn more

本主题列出了当前版本的 Microsoft 广告 SDK 的已知问题。This topic lists the known issues with the current release of the Microsoft Advertising SDK. 有关其他疑难解答指南,请参阅以下主题。For additional troubleshooting guidance, see the following topics.

XAML 中的 AdControl 接口未知AdControl interface unknown in XAML

适用于 AdControl 的 XAML 标记可能会错误显示暗示接口未知的蓝色曲线。The XAML markup for an AdControl may incorrectly show a blue curvy line implying that the interface is unknown. 这仅在面向 x86 时发生,并且可能会被省略。This occurs only when targeting x86, and it may be ignored.

之前广告请求的 lastErrorlastError from previous ad request

如果之前广告请求还留有 lastError,则在下一次广告调用期间,可能会引发该事件两次。If there is a leftover lastError from the previous ad request, the event may be fired twice during the next ad call. 尽管还是会提出新的广告请求,而且可能也会产生有效广告,但此行为可能会引起混淆。While the new ad request will still be made and may yield a valid ad, this behavior may cause confusion.

手机上的间隙广告和导航按钮Interstitial ads and navigation buttons on phones

在拥有软件后退开始以及搜索按钮而非硬件按钮的手机(仿真器)上,倒计时器和单击间隙广告的按钮可能会被遮住。On phones (or emulators) that have software Back, Start, and Search buttons instead of hardware buttons, the countdown timer and click through buttons for interstitial ads may be obscured.

未向你的应用投放最近创建的广告Recently created ads are not being served to your app

如果你最近(少于一天)创建了广告,可能不会立即可用。If you have created an ad recently (less than a day), it might not be available immediately. 如果广告的编辑内容已经过批准,则在广告服务器已对其进行处理并且该广告作为库存可用时会立即投放。If the ad has been approved for editorial content, it will be served once the advertising server has processed it and the ad is available as inventory.

你的应用中没有显示任何广告No ads are shown in your app

你没有看到广告的原因有很多,其中包括网络错误。There are many reasons you may see no ads, including network errors. 其他原因可能包括:Other reasons might include:

  • 在合作伙伴中心选择一个大小大于或小于应用程序代码中 adunitid 大小的 ad 单位。Selecting an ad unit in Partner Center with a size that is greater or less than the size of the AdControl in your app's code.

  • 在运行动态应用时,如果将测试模式值用于广告单元 ID,则广告不会显示。Ads will not appear if you're using a test mode value for your ad unit ID when running a live app.

  • 如果你在过去半小时创建了新的广告单元 ID,可能无法看到广告,直到服务器通过系统传播新数据为止。If you created a new ad unit ID in the past half-hour, you might not see an ad until the servers propagate new data through the system. 之前显示了广告的现有 ID 应会立即显示广告。Existing IDs that have shown ads before should show ads immediately.

如果你可以在应用中看到测试广告,则代码有效,并且能够显示广告。If you can see test ads in the app, your code is working and is able to display ads. 如果遇到问题,请联系产品支持人员If you encounter issues, contact product support. 在该页上 ,选择 "联系我们"On that page, choose Contact us.

你还可在论坛发布问题。You can also post a question in the forum.

应用中显示的是测试广告而非实时广告Test ads are showing in your app instead of live ads

可以显示测试广告,即使你希望显示实时广告。Test ads can be shown, even when you are expecting live ads. 这可在以下方案中发生:This can happen in the following scenarios:

  • 我们的广告平台无法验证或找到在应用商店中使用的动态应用程序 ID。Our advertising platform cannot verify or find the live application ID used in the Store. 在此情况下,当用户创建了某个广告单元时,它的状态仍然可以为动态(非测试),但会在提出首个广告请求 6 个小时内移动到测试状态。In this case, when an ad unit is created by a user, its status can start as live (non-test) but will move to test status within 6 hours after the first ad request. 如果测试应用 10 天内没有提出请求,状态将改回为动态。It will change back to live if there are no requests from test apps for 10 days.

  • 旁加载应用或在仿真器中运行的应用不会显示实时广告。Side-loaded apps or apps that are running in the emulator will not show live ads.

当实时 ad 单位提供测试广告时,ad 单位的状态显示为 "活动",并为 "合作伙伴中心" 提供测试广告When a live ad unit is serving test ads, the ad unit’s status shows Active and serving test ads in Partner Center. 这当前不适用于手机应用。This does not currently apply to phone apps.

项目中通过面向任何 CPU 引起的引用错误Reference errors caused by targeting Any CPU in your project

在使用 Microsoft 广告 SDK 时,你无法在项目中面向任何 CPUWhen using the Microsoft Advertising SDK, you cannot target Any CPU in your project. 如果你的项目面向任何 CPU 平台,可能会在添加类似于此引用的引用后看到警告。If your project targets the Any CPU platform, you may see a warning after adding the reference similar to this one.

referenceerror - solutionexplorer

若要删除此警告,请更新你的项目以使用特定于体系结构的生成输出(例如,x86)。To remove this warning, update your project to use an architecture-specific build output (for example, x86). 使用配置管理器以设置适用于调试和版本配置的平台目标。Use Configuration Manager to set the platform targets for debug and release configurations.

configurationmanagerwin10

在你为应用商店提交创建应用包(如下图所示)时,请确保包含计划面向的体系结构。When you create your app packages for store submission (as shown in the following images), be sure to include the architectures you intend to target. 如果计划在 x64 操作系统上运行 x86 版本,可以选择跳过 x64。You may opt to skip x64 if you intend to run x86 builds on the x64 OS.

projectstorecreateapppackages

createapppackages

JavaScript/HTML 应用中的 Z 顺序Z-order in JavaScript/HTML apps

JavaScript/HTML 应用不得将元素放入 Z 顺序的保留 MAX-10 范围。JavaScript/HTML apps must not place elements into the reserved MAX-10 range of z-order. 唯一的例外是中断覆盖层,例如 Skype 应用的入站呼叫通知。The sole exception is an interrupt overlay, such as an inbound call notification for a Skype app.

不要使用边框Do not use borders

设置由 AdControl 从父类继承的边框相关的属性将引起广告位置出错。Setting border-related properties inherited by the AdControl from its parent class will cause the ad placement to be wrong.

更多信息More Information

有关最新的已知问题和发布与 Microsoft 广告 SDK 相关的问题的详细信息,请访问论坛For more information about the latest known issues and to post questions related to the Microsoft Advertising SDK, visit the forum.