You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS特定Bundle Identifier下Google AdMob激励插屏广告无法加载求助

AdMob激励插屏广告仅在短Bundle Identifier下生效,完整Identifier无法加载的问题排查

我正在为已上线iOS应用集成Google AdMob激励插屏广告,使用CocoaPods/Swift Package Manager管理依赖。发现com.CreativeCub.ProgrammingHu这个短Bundle Identifier能正常加载广告,但使用正确的com.CreativeCub.ProgrammingHub时广告完全无法工作。

已完成的排查操作

  • 确认Xcode项目与AdMob后台的Bundle Identifier完全匹配
  • 反复核对AdMob后台中com.CreativeCub.ProgrammingHub对应的App ID和Ad Unit ID
  • 通过CocoaPods重新安装AdMob SDK
  • 切换到Swift Package Manager集成AdMob SDK
  • 创建独立测试项目排查现有项目的潜在问题

测试代码

//
//  ViewController.swift
//  TestAdmob
//
//  Created by Akshay on 05/10/24.
//

import UIKit
import GoogleMobileAds
import AppTrackingTransparency
import AdSupport

class ViewController: UIViewController, GADFullScreenContentDelegate {

    private var rewardedInterstitialAd: GADRewardedInterstitialAd?

  override func viewDidLoad() {
    super.viewDidLoad()
     
      loadRewardedInterstitialAd()
  }
    func loadRewardedInterstitialAd() {
            let adUnitID = "ca-app-pub-3940256099942544/6978759866"  // Replace with your actual Ad Unit ID
            GADRewardedInterstitialAd.load(withAdUnitID: adUnitID, request: GADRequest()) { [self] ad, error in
                if let error = error {
                    print("Failed to load rewarded interstitial ad with error: \(error.localizedDescription)")
                    return
                }
                rewardedInterstitialAd = ad
                rewardedInterstitialAd?.fullScreenContentDelegate = self
                print("Rewarded interstitial ad is ready.")
            }
        }
    
    
   
    @IBAction func showAction(_ sender: Any) {
        
        if let ad = rewardedInterstitialAd {
               ad.present(fromRootViewController: self) {
                   let reward = ad.adReward
                   print("User earned reward: \(reward.amount) \(reward.type)")
                   // Reward the user here (e.g., give in-app currency or extra lives)
               }
           } else {
               print("Ad wasn't ready")
           }
    }
    
    

}

extension ViewController {
    func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
        print("Ad was dismissed.")
        // Load a new ad
        loadRewardedInterstitialAd()
    }

    func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
        print("Ad failed to present full screen content with error: \(error.localizedDescription)")
    }

    func adDidPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
        print("Ad did present full screen content.")
    }
}

可能的解决方向

  1. AdMob后台应用审核状态:检查AdMob后台中com.CreativeCub.ProgrammingHub对应的应用是否处于已审核通过状态。新创建的AdMob应用/广告单元可能需要数小时甚至1-2天的审核时间,未审核通过的情况下无法获取真实广告(即使测试广告也可能受影响)。
  2. 测试广告单元的特殊性:代码中使用的是AdMob官方测试广告单元ca-app-pub-3940256099942544/6978759866,尝试替换为你自己创建的对应com.CreativeCub.ProgrammingHub的真实广告单元ID测试(注意:真实广告单元需要应用审核通过后才能生效)。
  3. Xcode项目隐藏配置问题:
    • 检查项目Info.plist中的GADApplicationIdentifier,确认其值与AdMob后台对应应用的App ID完全一致。
    • 清理Xcode项目缓存(Cmd+Shift+K),删除Derived Data后重新构建项目。
    • 检查所有Target(包括主Target和Extension)的Build Settings中Product Bundle Identifier是否均设置为com.CreativeCub.ProgrammingHub,避免个别Target ID不匹配导致验证失败。
  4. AdMob后台应用关联状态:确认com.CreativeCub.ProgrammingHub的应用是否正确关联你的AdMob账号,未被标记为违规或限制状态。
  5. 网络与地区限制:测试时确保设备网络正常,且处于允许AdMob投放广告的地区,可尝试用VPN切换地区验证。

内容的提问来源于stack exchange,提问作者Akshaykumar Maldhure

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 09:10:01