I made a package that depends on GoogleMobileAds. I used to add my package as dependency on my apps and it used to load GoogleMobileAds. Something changed now and I observe this behaviour:
- Swift Package compiles without error.
- When I add package to my project (through Github), GoogleMobileAds and GoogleUserMessagingPlatform (dependency of GoogleMobileAds) are loaded and I can see them on the "Package Dependencies" section on the left.
- After adding my package, my project does not compile anymore with error messages: 1) "Undefined symbols:", and "Linker command failed with exit code 1"
When I navigate to target –> Frameworks, Libraries, and Embedded Content, I can not find GoogleMobileAds there..
Here is my Package.swift
let package = Package(
name: "MikrasyaLibraryAds",
platforms: [.iOS(.v15)],
products: [
.library(
name: "MikrasyaLibraryAds",
targets: ["MikrasyaLibraryAds"]),
],
dependencies: [
.package(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", branch: "main"),
],
targets: [
.target(
name: "MikrasyaLibraryAds",
dependencies: [ .product(name: "GoogleMobileAds", package: "swift-package-manager-google-mobile-ads"),
]
),
]
)
Edit 1:
Here is the build message:
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][399](GADMarketplaceKitSignals.o)
l008 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
enum case for MarketplaceKit.AppDistributor.marketplace(MarketplaceKit.AppDistributor.Type) -> (Swift.String) -> MarketplaceKit.AppDistributor, referenced from:
l007 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
l008 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
enum case for MarketplaceKit.AppDistributor.other(MarketplaceKit.AppDistributor.Type) -> MarketplaceKit.AppDistributor, referenced from:
l007 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
l008 in GoogleMobileAds[arm64][399](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][399](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][399](GADMarketplaceKitSignals.o)
enum case for MarketplaceKit.AppDistributor.appStore(MarketplaceKit.AppDistributor.Type) -> MarketplaceKit.AppDistributor, referenced from:
l007 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
l008 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
type metadata accessor for MarketplaceKit.AppDistributor, referenced from:
l007 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
l008 in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
nominal type descriptor for MarketplaceKit.AppDistributor, referenced from:
_symbolic _____Sg 14MarketplaceKit14AppDistributorO in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
__swift_FORCE_LOAD_$_swiftXPC, referenced from:
__swift_FORCE_LOAD_$_swiftXPC_$_GoogleMobileAds in GoogleMobileAds[arm64][399](GADMarketplaceKitSignals.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Other observations:
- If I remove my package and add GoogleMobileAds directly it works fine..
- If I keep the package and add GoogleMobileAds also, I still have the compile problem above..
Thank you.
2
Answers
It seems this issue started with AdMob SDK version 11.6.0. Before that it works just fine.. So, some change in Admob SDK is causing this issue..
For now, we will use 11.5.0 and hope it will be fixed in upcoming revisions.
I had the same issue but i also got a dependency problem, because react-native-google-mobile-ads needed the Version Google-Mobile-Ads-SDK (= 11.7.0).
I looked in the RNGoogleMobileAds.podspec from the library react-native-google-mobile-ads to find out I have to set the Version like this
$RNGoogleMobileAdsSDKVersion = ‘11.5.0’ in the podfile