GooglePlacesRow icon indicating copy to clipboard operation
GooglePlacesRow copied to clipboard

Conflicting Frameworks

Open Vortec4800 opened this issue 4 years ago • 4 comments

I was having a bunch of issues using this with my project. My project has Firebase installed, which includes a bunch of Google libraries by default.

This framework bundles older versions of GooglePlaces and GoogleMaps base along with, which causes a bunch of errors on launch complaining about the duplication of symbols. The framework also doesn't work, even though I'm setting my API key the app was telling me I didn't have authentication.

The issue was that when I set the API key, that was happening on a different copy of the framework as the one the GooglePlacesRow was trying to use.

My fix is pretty simple, instead of bundling the Google frameworks, just tell Cocoapods that there are dependencies on GooglePlaces and GoogleMaps/Base and let it figure everything out. This removed the duplicate copy and everything worked as expected. You also have to tell Cocoapods that this framework is now a static framework, because the Google frameworks are also static. This didn't seem to have any ill effects.

You can see the changes I made to the pod spec file in my fork here: https://github.com/Vortec4800/GooglePlacesRow/blob/master/GooglePlacesRow.podspec

The only other thing I had to do was also import GoogleMapsBase in the Row swift file, as it's no longer included by default.

Vortec4800 avatar Feb 09 '20 18:02 Vortec4800

Thanks for the detailed workaround. The issue was obviously known but for projects that do not include GoogleMaps this pod must specify them as dependency.

Maybe there is some way to add the dependencies as a subspec or so (thus making them optional)

mats-claassen avatar Feb 10 '20 14:02 mats-claassen

Well the pod still does specify them as a dependency, it just tells Cocoapods that the frameworks are required and leaves the installation to it. That way if you have multiple pods that require the same framework, it will only be resolved once.

Why would you want to make them optional? Aren't those frameworks required? I guess I don't understand the goal.

Vortec4800 avatar Feb 10 '20 16:02 Vortec4800

Oh I see. I thought they were removed. We hadn't specified them as dependencies before as that didn't work with static frameworks. And making a pod static seems to have been added in Cocoapods 1.5.0. If you want to create a pull request that would be great. Otherwise I will make those changes.

mats-claassen avatar Feb 17 '20 12:02 mats-claassen

Done. You'll have to take a look and let me know if I missed anything dumb.

Vortec4800 avatar Feb 17 '20 14:02 Vortec4800