Ios 如何在从UIview扩展的类中实现GMSMapViewDelegate?
我有多目标应用程序,他们必须使用谷歌地图我决定创建cocoa touch框架,添加所有谷歌地图依赖项,并创建一个nib来显示谷歌地图。这项工作成功,我可以在嵌入我的框架的项目中重用该nib文件,我可以在地图上显示用户的当前位置,但我需要实现GMSMapViewDelegate用于检测地图何时移动,但在实施GMSMapViewDelegate时,我得到以下错误: ld:未找到架构arm64的GoogleMaps框架 叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用) 这是我的nib文件类Ios 如何在从UIview扩展的类中实现GMSMapViewDelegate?,ios,google-maps,swift3,cocoa-touch,Ios,Google Maps,Swift3,Cocoa Touch,我有多目标应用程序,他们必须使用谷歌地图我决定创建cocoa touch框架,添加所有谷歌地图依赖项,并创建一个nib来显示谷歌地图。这项工作成功,我可以在嵌入我的框架的项目中重用该nib文件,我可以在地图上显示用户的当前位置,但我需要实现GMSMapViewDelegate用于检测地图何时移动,但在实施GMSMapViewDelegate时,我得到以下错误: ld:未找到架构arm64的GoogleMaps框架 叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用) 这是我的nib文件
import UIKit
import GoogleMaps
class GoogleMapView: UIView,MyLocationManagerDelegate,GMSMapViewDelegate {
let marker = GMSMarker()
@IBOutlet weak var geoCodeAddressTxtfield: UITextField!
@IBOutlet var mapView: GMSMapView!
public var geoAddresshandler :((_ lat :CLLocationDegrees, _ long :CLLocationDegrees) -> Void)?
private let nibName :String = "GoogleMapXib"
let locationManager = MyLocationManager()
public override init(frame : CGRect){
super.init(frame: frame)
setup()
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
locationManager.delegate = self
setup()
}
func getLocationCordination(long: CLLocationDegrees, lat: CLLocationDegrees) {
let camera = GMSCameraPosition.camera(withLatitude: lat, longitude: long, zoom: 17)
mapView.camera = camera
mapView.animate(to: camera)
mapView.isMyLocationEnabled = true
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: lat, longitude: long)
marker.map = mapView
}
func mapView(_ mapView: GMSMapView, didTapAt coordinate: CLLocationCoordinate2D) {
print("You tapped at \(coordinate.latitude), \(coordinate.longitude)")
}
private func setup(){
self.mapView = UINib(nibName: nibName, bundle: Bundle(for: type(of: self))).instantiate(withOwner: self, options: nil)[0] as! GMSMapView
self.mapView.frame = bounds
self.mapView.autoresizingMask = [.flexibleWidth , .flexibleHeight]
self.addSubview(self.mapView)
self.geoCodeAddressTxtfield.becomeFirstResponder()
mapView.bringSubview(toFront: self.geoCodeAddressTxtfield)
}
func mapView(mapView: GMSMapView!, didTapAtCoordinate coordinate: CLLocationCoordinate2D) {
}
func mapView(_ mapView: GMSMapView, willMove gesture: Bool){
mapView.hideKeyboardWhenTappedAround()
}
func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition){}
}
您是否在链接二进制文件中添加了框架?是的,我可以在使用我的框架的项目中重用此nib文件?您是否在链接二进制文件中添加了框架?是的,我可以在使用我的框架的项目中重用此nib文件