gpt4 book ai didi

ios - 我的应用程序现在在尝试实现 RevMob 后抛出错误

转载 作者:行者123 更新时间:2023-11-28 18:52:09 26 4
gpt4 key购买 nike

我得到的错误是:

Cannot convert value of type '(NSError!) -> Void' to expected argument type '((Error?) -> Void)!

导致这个错误的代码是

RevMobAds.startSessionWithAppID("<YOUR_APP_ID>",     
withSuccessHandler: completionBlock,
andFailHandler: failureBlock)

有没有人在使用 RevMob 之前遇到过这个错误,或者对如何修复有任何想法?谢谢

我得到的错误: Error Getting Thrown

最佳答案

您可能正在使用新的 Xcode 和 Swift 3.0。 Objective-C 转换为 swift 的方式发生了一些变化。

您只需将文档中的 errorBlock 代码更改为:

let errorBlock: ((Error?) -> Void)! = {error in   //  <==  only this line changed
// check the error
print(error)
}

并将参数名称添加到 startSession 调用中:

RevMobAds.startSession(withAppID: "<YOUR_APP_ID>",   //  only this line changed
withSuccessHandler: completionBlock,
andFailHandler: errorBlock);

关于ios - 我的应用程序现在在尝试实现 RevMob 后抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39814202/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com