我按照文档在我的应用程序中添加了 MobFox 广告。出于某种原因,我收到错误消息:无法连接到服务器。
func mobFoxAdDidFailToReceiveAdWithError(_ error:Error!) {
print("MobFoxAdDidFailToReceiveAdWithError: ", error.localizedDescription)
}
它给出: MobFoxAdDidFailToReceiveAdWithError: 无法连接到服务器。
private var mobfoxAd: MobFoxAd!
override func viewDidLoad() {
super.viewDidLoad()
let rect = CGRect(origin: CGPoint(x: 0, y: 200), size: CGSize(width:320, height: 50))
mobfoxAd = MobFoxAd("fe96717d9875b9da4339ea5367eff1ec", withFrame: rect)
mobfoxAd.delegate = self
mobfoxAd.refresh = adRefresh as NSNumber?
self.view.addSubview(mobfoxAd)
}
在我的 Info.plist 文件中,我添加了。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
我似乎找不到原因。谢谢。