Question

Error after adding google_mobile_ads sdk in swift using CocoaPods

I added the google_mobile_ads sdk v11.6.0 in my swift project. Now when I run the project I get the following error

ld: warning: Could not find or use auto-linked library 'swiftXPC': library 'swiftXPC' not found
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: warning: Could not find or use auto-linked framework 'MarketplaceKit': framework 'MarketplaceKit' not found
ld: Undefined symbols:
  enum case for MarketplaceKit.AppDistributor.testFlight(MarketplaceKit.AppDistributor.Type) -> MarketplaceKit.AppDistributor, referenced from:
      l007 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
      l008 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  enum case for MarketplaceKit.AppDistributor.marketplace(MarketplaceKit.AppDistributor.Type) -> (Swift.String) -> MarketplaceKit.AppDistributor, referenced from:
      l007 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
      l008 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  enum case for MarketplaceKit.AppDistributor.other(MarketplaceKit.AppDistributor.Type) -> MarketplaceKit.AppDistributor, referenced from:
      l007 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
      l008 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  static MarketplaceKit.AppDistributor.current.getter : MarketplaceKit.AppDistributor, referenced from:
      function signature specialization <Arg[0] = Dead> of static GoogleMobileAds.GADMarketplaceKitSignals.appDistributor() async -> Swift.String in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  async function pointer to static MarketplaceKit.AppDistributor.current.getter : MarketplaceKit.AppDistributor, referenced from:
      function signature specialization <Arg[0] = Dead> of static GoogleMobileAds.GADMarketplaceKitSignals.appDistributor() async -> Swift.String in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  enum case for MarketplaceKit.AppDistributor.appStore(MarketplaceKit.AppDistributor.Type) -> MarketplaceKit.AppDistributor, referenced from:
      l007 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
      l008 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  type metadata accessor for MarketplaceKit.AppDistributor, referenced from:
      l007 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
      l008 in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  nominal type descriptor for MarketplaceKit.AppDistributor, referenced from:
      _symbolic _____Sg 14MarketplaceKit14AppDistributorO in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
  __swift_FORCE_LOAD_$_swiftXPC, referenced from:
      __swift_FORCE_LOAD_$_swiftXPC_$_GoogleMobileAds in GoogleMobileAds[arm64][423](GADMarketplaceKitSignals.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

when I remove google_mobile_ads SDK from pods everything works fine

 3  609  3
1 Jan 1970

Solution

 2

I had the same error, I solved it by installing version 11.0 of AdMob forcibly.

By specifying in Podfile: Google-Mobile-Ads-SDK', '11.0' in the pod Google-Mobile-Ads-SDK.

After installing version 11.0, there was an error "Sandbox: bash(72986) deny(1)". I eliminated it by setting the

User Script Sandboxing parameter in Build Settings to No.

And everything worked successfully.

P.S Perhaps you can use more recent versions than 11.0, but I have not checked it.

2024-07-02
Oleksandr Tretiakov

Solution

 2

11.6.0 2024-06-17
Added a dependency on MarketplaceKit. This requires apps to build with Xcode 15.3 or above. MarketplaceKit is Swift-only, so a Swift placeholder file has been added to the distribution so Swift standard libraries are included in apps even if they don't contain other Swift files.

Two solutions.

  1. Use xcode15.3 and above
  2. Specify the fixed version pod 'Google-Mobile-Ads-SDK', '11.5.0'
2024-07-03
Jerry