GoogleMaps SPM integration: GMSAddress.h yields "Module 'GoogleMapsBase' not found" error
Environment details
- Integrating into iOS 14+ framework through Xcode Project (not Package.swift)
- Using Xcode 15.1
- GoogleMaps version 8.3.1
Steps to reproduce
- Add GoogleMaps SPM dependency
- Link it to the framework Target
- Build
- Error
Module 'GoogleMapsBase' not foundoccurs inGMSAddress.h
Screenshot
If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.
@ogarkov-dev Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:
- Check the issue tracker - bugs and feature requests for Google Maps Platform APIs and SDKs
- Open a support case - Get 1:1 support in Cloud Console.
- Discord - chat with other developers
-
StackOverflow - use the
google-mapstag
This is an automated message, feel free to ignore.
Here is a simple Playground that reproduces the issue on my system. It is just an empty Playground that is using an ios-maps-sdk SPM dependency without any other changes. ios-maps-sdk_compile_issue_Playground.zip
Have you tried updating the dependency section by adding all the products as follows?
dependencies: [
.product(name: "GoogleMaps", package: "ios-maps-sdk"),
.product(name: "GoogleMapsBase", package: "ios-maps-sdk"),
.product(name: "GoogleMapsCore", package: "ios-maps-sdk"),
]
In Xcode after you enter the URL https://github.com/googlemaps/ios-maps-sdk/ you need to keep checked or check all these three package products.
Please let us know if following these steps resolved your problem?
@dogahe That helped! Thank you! IMO the package should've resolved the internal dependencies by itself. Is it coming in the next releases? If not, then we should consider updating README.
Im' using XcodeGen in my project to manage the dependencies. @dogahe I can not find the way to use your work-around with XcodeGen.
Can you please share the current configuration you have set up in your .yaml file for adding dependency on GoogleMaps?
I do not have experience with XcodeGen, but I can imagine that you need to be able to either specify multiple package products for each package or repeat the lines for adding the dependency for each package product of GoogleMaps.
Can you please share the current configuration you have set up in your .yaml file for adding dependency on GoogleMaps?
I do not have experience with XcodeGen, but I can imagine that you need to be able to either specify multiple package products for each package or repeat the lines for adding the dependency for each package product of GoogleMaps.
In project_packages.yml file I added the package like others:
GoogleMaps:
url: https://github.com/googlemaps/ios-maps-sdk
version: 8.3.1
And in project_tarjets.yml file I added the dependencies for the module where I need GoogleMaps of my project like this:
ModuleName:
dependencies:
- package: GoogleMapsUtils
product: GoogleMapsUtils
- package: GoogleMaps
product: GoogleMaps
- package: GoogleMaps
product: GoogleMapsBase
- package: GoogleMaps
product: GoogleMapsCore
The project is generated by xcodegen without error and with this configuration I don't getting the error of this thread but as you can see I'm using GoogleMapsUtils and I'm getting this other error -> https://github.com/googlemaps/google-maps-ios-utils/issues/458
So, I have to wait for some kind of fix in this package or in GoogleMapsUtils.
GoogleMapsUtils is a different package. Please follow up on the relevant thread for any problem you have with GoogleMapsUtils since the error you are observing is not related to Google Maps Swift package. I am glad GoogleMaps Swift package is working for you now.
@dogahe I hear you but we only get the error above when we add googlemaps from this repo. So there is some dependency between the 2 causing this error.
Same here. Only for version below 9.0.0