由于网络错误 - IMA SDK 错误和 iOS,无法从服务器请求广告

Posted

技术标签:

【中文标题】由于网络错误 - IMA SDK 错误和 iOS,无法从服务器请求广告【英文标题】:Unable to request ads from server due to network error- IMA SDK Error and iOS 【发布时间】:2017-05-10 19:00:08 【问题描述】:

我正在使用 IMA SDK (ios - Swift) 播放前贴片广告 (Wrapper VAST 3.0) 但是当我使用这个网址“http://fusioniprojects.com/rnd/addpod/adpods.xml”

我的日志中出现以下错误 "由于网络错误,无法从服务器请求广告。"

当我使用这种类型的 url -

“https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dredirecterror&correlator=”

它运行良好。

我从这里 (ref - https://groups.google.com/forum/#!topic/ima-sdk/DqE5GruzwwA) 开始解决这个问题,

现在它在 android 项目中只播放 1 个广告,而不是多个广告,并且根本不适用于 iOS。

可能是我在我的 iOS 项目中做错了一些事情,但我也从 IMA-SDK 下载了示例项目(参考 - https://github.com/googleads/googleads-ima-ios/releases),但这并没有帮助我解决这个问题,我我遇到了同样的错误。我不知道在服务器上进行更改后,Android 项目的运行情况(至少 1 个广告)。

是IMA-SDK的问题吗?还是我做错了什么?

在 iOS 中使用 IMA SDK 3.3.1 版。

【问题讨论】:

问题解决了吗? 【参考方案1】:

如果您使用的是 Apache 服务器,那么要使用 Apache 将 CORS 授权添加到标头,只需在服务器配置的 Directory、Location、File 或 VirtualHost 部分中添加以下行(通常位于 *.conf 文件中,例如 httpd.conf 或 apache.conf),或在 .htaccess 文件中:放在 .htacces 文件中的代码下方。

Header set Access-Control-Allow-Origin '*'
Header set Access-Control-Allow-Credentials true

【讨论】:

以上是关于由于网络错误 - IMA SDK 错误和 iOS,无法从服务器请求广告的主要内容,如果未能解决你的问题,请参考以下文章

Spotify SDK 播放器不工作:错误 Domain=com.spotify.ios-sdk.playback Code=1 “由于未指定的问题,操作失败。”

iOS小技能:封装定位SDK,统一数据模型和错误处理。

iOS:Facebook SDK AppInvite 错误 9

错误代码 100 适用于 iOS 的解析 SDK

为 Swift 更新适用于 iOS 14 的 Google IMA SDK 隐私政策

由于 Xamarin iOS SDK 版本,AzureDevops 构建失败