저는 iOS 개발을 처음 사용하고 있으며 Google지도 SDK를 사용하여 간단한 앱을 사용해보고 있습니다. Google Maps Getting Started guide에 나와있는 단계를 따르고 있습니다.Google지도 iOS SDK :지도가로드되지 않습니다.
나는 유사한 질문을 보았다. Google Maps iOS SDK Integration not loading maps 문제는 번들 ID와 관련있다. 나는 그것이 나를위한 것이 아니라는 것을 확인했다.
이미 3 일 동안 처음부터 새로운 앱을 사용해 보았습니다.
내 번들 ID를 추가하고 새 API 키를 만들었습니다.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. GMSServices.provideAPIKey("MYKEY") return true }
다음은 ViewController.swift입니다 :
import UIKit
import GoogleMaps
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let camera = GMSCameraPosition.camera(withLatitude: -33.86, longitude: 151.20, zoom: 6.0)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
view = mapView
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20)
marker.title = "Sydney"
marker.snippet = "Australia"
marker.map = mapView
}
}
내가 시뮬레이터와 실제 전화를 실행
GoogleInfo.plist를 다운로드하여 프로젝트의 대상에 추가 했습니까? – Aks
코드에 문제가 있습니다. 하나는지도의 직사각형을 설정하고 두 번째는 서브 뷰로지도를 추가해야합니다. 이 튜토리얼을 따라 할 수 있습니다 https://www.raywenderlich.com/109888/google-maps-ios-sdk-tutorial –
포인터를 주셔서 감사합니다 - 나는 .plist를 추가하지 않았으며 나는 단지 시작 가이드를 따라 다니고있었습니다. 나는 당신의 제안을 시도하고 돌아올 것입니다. – kal