0

I have made an objective-C custom framework for my client. The custom framework has many features, one of them is map. I built it on top of Google Maps SDK with some additional actions on map. I added these frameworks and bundle to my custom framework project

GoogleMapsCore.framework
GoogleMapsBase.framework
GoogleMaps.framework
GoogleMaps.bundle

The custom framework works fine for almost client's apps UNTIL one client integrates my custom framework but they also included those above Google Map frameworks to their project before for their app private purpose which isn't related to my map on custom framework purpose.

Their app can build successfully but on runtime it crashes with the exception

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[GMSx_GMPCClientVectorTileExtensionsRoot indoorBuildingMetadata]: unrecognized selector sent to class 0x10xxxxxxx'

Along with it, I receives a ton of logs similar to

objc[483]: Class GMSBaseClearcutClient is implemented in both /private/var/containers/Bundle/Application/2BA0B2AF-5D3D-4664-BAB4-866D3BC9FFCE/<main_app>.app/Frameworks/<my_custom_framework>.framework/<my_custom_framework_name> (0x10xxxxxx) and /private/var/containers/Bundle/Application/2BA0B2AF-5D3D-4664-BAB4-866D3BC9FFCE/<main_app>.app/<main_app_name> (0x10xxxxxxx). One of the two will be used. Which one is undefined.

I searched around the Internet and found that the problem may be app added those 4 Google Map frameworks and bundle more than once as the following explanation

Google Maps not displaying - Failed to decode tile

I suppose the problem is app added these Google Map framework itself and my custom framework also added those, too.

So my question is how can we make the app only recognizes those Google map SDK on app project directory, not those on the custom framework. Is there any way to configure the custom framework can absolutely hide its add-in framework from external app

Scofield Tran
  • 828
  • 1
  • 18
  • 30

2 Answers2

1

I met a similar question, to solve it by

Add -all_load to the other linker flags in your build settings.

-all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code.


the problem supposed that app added these Google Map framework itself and my custom framework also added those,

I don't think so.

If so, Xcode will report ambiguous methods / duplicate symbol

dengApro
  • 3,848
  • 2
  • 27
  • 41
0

I don't know the reason, but on the client app's -who use google map on their project- Pods-[AppName].debug.xcconfig file that cocoapods creates they will find OTHER_LDFLAGS and you'll see it links to the same frameworks you link in your framework. So if they remove -framework [Duplicated framework] the warning disappears.

Seems to be a cocoapods error

refer to https://stackoverflow.com/a/46933115/7077168

abed
  • 71
  • 7