ios-maps-sdk icon indicating copy to clipboard operation
ios-maps-sdk copied to clipboard

GoogleMaps SPM integration: GMSAddress.h yields "Module 'GoogleMapsBase' not found" error

Open ogarkov-dev opened this issue 2 years ago • 10 comments

Environment details

  • Integrating into iOS 14+ framework through Xcode Project (not Package.swift)
  • Using Xcode 15.1
  • GoogleMaps version 8.3.1 Screenshot 2023-12-27 at 18 33 47

Steps to reproduce

  1. Add GoogleMaps SPM dependency
  2. Link it to the framework Target
  3. Build
  4. Error Module 'GoogleMapsBase' not found occurs in GMSAddress.h

Screenshot

Screenshot 2023-12-27 at 18 35 15

ogarkov-dev avatar Dec 27 '23 17:12 ogarkov-dev

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:

This is an automated message, feel free to ignore.

wangela avatar Dec 27 '23 17:12 wangela

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

ogarkov-dev avatar Dec 27 '23 17:12 ogarkov-dev

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 avatar Dec 27 '23 18:12 dogahe

@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.

ogarkov-dev avatar Dec 27 '23 21:12 ogarkov-dev

Im' using XcodeGen in my project to manage the dependencies. @dogahe I can not find the way to use your work-around with XcodeGen.

ggdiez avatar Jan 22 '24 09:01 ggdiez

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.

dogahe avatar Jan 22 '24 11:01 dogahe

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.

ggdiez avatar Jan 25 '24 12:01 ggdiez

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 avatar Jan 29 '24 16:01 dogahe

@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.

Jodebjo avatar Feb 26 '24 09:02 Jodebjo

Same here. Only for version below 9.0.0

Fl0p avatar Jul 10 '24 12:07 Fl0p