I have a working project with GoogleMaps in it that works fine. I made a copy of that project to make the project modular and now I get an EXC_BAD_ACCESS error when I try to open the map.
here is my pod configuration:
def shared_pods
...
end
def application_pods
...
pod 'GoogleMaps'#, :modular_headers => true
pod 'GooglePlaces', :modular_headers => true
end
def core_application_pods
...
pod 'GooglePlaces', :modular_headers => true
end
target 'Application' do
project 'Application/Application.xcodeproj'
# Pods for Application
shared_pods
application_pods
target 'ApplicationTests' do
inherit! :search_paths
# Pods for testing
end
target 'ApplicationUITests' do
# Pods for testing
end
end
target 'Core' do
project 'Core/Core.xcodeproj'
# Pods for Core
shared_pods
core_application_pods
target 'CoreTests' do
inherit! :search_paths
# Pods for testing
end
end
I even tried putting both pods in shared_pods, enable/disable modular_headers and there is no difference in the outcome.
Here is some of the code which creates the UIGMapsView object. The object is created successfully and Maps delegates are fired before the crash..
final fileprivate func setupMapViewConstraints() {
if self.mapView == nil {
let mapView = UIGMapsView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
mapView.gmapDelegate = self
mapView.translatesAutoresizingMaskIntoConstraints = false
mapView.settings.myLocationButton = false
self.mapView = mapView
}
if let mapView = self.mapView {
self.view.addSubview(mapView)
self.view.sendSubviewToBack(mapView)
let views : [String: UIView] = ["mapView": mapView]
let vertical = NSLayoutConstraint.constraints(withVisualFormat: "V:|[mapView]|", options: [], metrics: nil, views: views)
let horizontal = NSLayoutConstraint.constraints(withVisualFormat: "H:|[mapView]|", options: [], metrics: nil, views: views)
NSLayoutConstraint.activate(vertical + horizontal)
autoreleasepool {
mapView.startMonitoringLocation()
mapView.backToMyPosition()
}
}
}
The screen opens up and about 1 second in that screen the crash appears. (I can even see the blue dot in the middle of the map but the map is all grey...)
I even tried enabling Zombie to try to catch whats is causing this but not much of help there too... here is the screenshot:
Does anyone know what might be causing this crash?
Thanks in advance!
EDITED:
I tried the solution mentioned below and I got these link errors on build time:
Undefined symbols for architecture arm64: "_OBJC_METACLASS_$_GMSx_GPBMessage", referenced from: _OBJC_METACLASS_$_GMSx_LocationEvent in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCAppProfileProto in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCLatLngProto in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCRectProto in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCPlacesEventProto in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCPlacesQueryLogProto in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCPlacesSearchQueryLogProto in GooglePlaces ... "_OBJC_METACLASS_$_GMSx_GPBRootObject", referenced from: _OBJC_METACLASS_$_GMSx_LocationRoot in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCAppidRoot in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCGeometryRoot in GooglePlaces _OBJC_METACLASS_$_GMSx_PCCPlacesRoot in GooglePlaces "_OBJC_CLASS_$_GMSx_GPBFileDescriptor", referenced from: objc-class-ref in GooglePlaces "_OBJC_CLASS_$_GMSx_GPBDescriptor", referenced from: objc-class-ref in GooglePlaces "_OBJC_CLASS_$_GMSx_GIPClearcutLogger", referenced from: objc-class-ref in GooglePlaces "_OBJC_CLASS_$_GMSx_GPBEnumDescriptor", referenced from: objc-class-ref in GooglePlaces "_OBJC_CLASS_$_GMSx_LogEvent", referenced from: objc-class-ref in GooglePlaces "_OBJC_CLASS_$_GMSx_GPBMessage", referenced from: _OBJC_CLASS_$_GMSx_LocationEvent in GooglePlaces _OBJC_CLASS_$_GMSx_PCCAppProfileProto in GooglePlaces _OBJC_CLASS_$_GMSx_PCCLatLngProto in GooglePlaces _OBJC_CLASS_$_GMSx_PCCRectProto in GooglePlaces _OBJC_CLASS_$_GMSx_PCCPlacesEventProto in GooglePlaces _OBJC_CLASS_$_GMSx_PCCPlacesQueryLogProto in GooglePlaces _OBJC_CLASS_$_GMSx_PCCPlacesSearchQueryLogProto in GooglePlaces ... "_OBJC_CLASS_$_GMSx_GPBRootObject", referenced from: _OBJC_CLASS_$_GMSx_LocationRoot in GooglePlaces _OBJC_CLASS_$_GMSx_PCCAppidRoot in GooglePlaces _OBJC_CLASS_$_GMSx_PCCGeometryRoot in GooglePlaces _OBJC_CLASS_$_GMSx_PCCPlacesRoot in GooglePlaces "_OBJC_CLASS_$_GMSx_GTMSessionFetcherService", referenced from: objc-class-ref in GooglePlaces "_OBJC_CLASS_$_GMSCoordinateBounds", referenced from: objc-class-ref in GooglePlaces ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)