我正在使用 SDK (AdColony) 向用戶展示廣告。AdColonyZone 物件中有一個抽象方法。
這是頭檔案:https ://github.com/AdColony/AdColony-iOS-SDK/blob/master/AdColony.xcframework/ios-arm64_armv7/AdColony.framework/Headers/AdColonyZone.h
我使用的方法 (setReward) 的參考在第 78 行:
- (void)setReward:(nullable void (^)(BOOL success, NSString *name, int amount))reward;
檔案:https ://github.com/AdColony/AdColony-iOS-SDK/wiki/Showing-Rewarded-Interstitial-Ads
檔案中的示例代碼:
let rewardedZones:Array<String> = [/* Rewarded Zone IDs */]
AdColony.configure(withAppID: /* App ID */, zoneIDs: /* Zone IDs */, options: nil) { [weak self] (zones) in
for zone in zones {
if rewardedZones.contains(zone.identifier) {
zone?.setReward = { [weak self] (success, name, amount) in
if success {
self?.rewardUser(coinsAmount: amount, currencyName: name)
}
}
}
}
}
這是我的代碼:
AdColony.configure(withAppID: "MY_APP_ID", zoneIDs: ["MY_ZONE_ID"], options: nil){ (zones) in
for zone in zones {
zone.setReward = { (success, name, amount) in
if success {
// TODO: Something...
}
}
}
}
我無法設定“setReward”。我收到此錯誤:
error: cannot assign to value: 'setReward' is a method
zone.setReward = { (success, name, amount) in
~~~~~^~~~~~~~~
如何設定 setReward 處理程式?
uj5u.com熱心網友回復:
AdColony.configure(withAppID: "MY_APP_ID", zoneIDs: ["MY_ZONE_ID"], options: nil){ (zones) in
for zone in zones {
zone.setReward { success, name, amount in
if success {
// TODO: Something...
}
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/415465.html
標籤:
上一篇:斯威夫特,堅持做筆記應用程式,不知道使用文本編輯器有什么問題
下一篇:決議附近的Wiki
