###問題点
シュミレーターを起動するとこの表示から地形が読み込まれません。
ピンはシドニーを指しています。
拡大、縮小はできます。
地形を読み込まれるようにしたいです。
よろしくお願いします。
###コード
AppDelegate
1//AppDelegate.swift 2import UIKit 3import GoogleMaps 4import GooglePlaces 5 6@UIApplicationMain 7class AppDelegate: UIResponder, UIApplicationDelegate { 8 9 var window: UIWindow? 10 11 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 12 GMSServices.provideAPIKey("**key**") 13 GMSPlacesClient.provideAPIKey("**key**") 14 return true 15 } 16 17 // MARK: UISceneSession Lifecycle 18 19 @available(iOS 13.0, *) 20 func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 21 // Called when a new scene session is being created. 22 // Use this method to select a configuration to create the new scene with. 23 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 24 } 25 26 @available(iOS 13.0, *) 27 func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { 28 // Called when the user discards a scene session. 29 // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 30 // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 31 } 32}
SceneDelegate
1//SceneDelegate.swift 2 3 4import UIKit 5 6class SceneDelegate: UIResponder, UIWindowSceneDelegate { 7 8 var window: UIWindow? 9 10 11 @available(iOS 13.0, *) 12 func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 13 // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 14 // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 15 // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 16 guard let _ = (scene as? UIWindowScene) else { return } 17 } 18 19 @available(iOS 13.0, *) 20 func sceneDidDisconnect(_ scene: UIScene) { 21 // Called as the scene is being released by the system. 22 // This occurs shortly after the scene enters the background, or when its session is discarded. 23 // Release any resources associated with this scene that can be re-created the next time the scene connects. 24 // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 25 } 26 27 @available(iOS 13.0, *) 28 func sceneDidBecomeActive(_ scene: UIScene) { 29 // Called when the scene has moved from an inactive state to an active state. 30 // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 31 } 32 33 @available(iOS 13.0, *) 34 func sceneWillResignActive(_ scene: UIScene) { 35 // Called when the scene will move from an active state to an inactive state. 36 // This may occur due to temporary interruptions (ex. an incoming phone call). 37 } 38 39 @available(iOS 13.0, *) 40 func sceneWillEnterForeground(_ scene: UIScene) { 41 // Called as the scene transitions from the background to the foreground. 42 // Use this method to undo the changes made on entering the background. 43 } 44 45 @available(iOS 13.0, *) 46 func sceneDidEnterBackground(_ scene: UIScene) { 47 // Called as the scene transitions from the foreground to the background. 48 // Use this method to save data, release shared resources, and store enough scene-specific state information 49 // to restore the scene back to its current state. 50 } 51}
ViewController
1//ViewController.swift 2import UIKit 3import GoogleMaps 4import GooglePlaces 5 6class ViewController: UIViewController { 7 8 override func viewDidLoad() { 9 super.viewDidLoad() 10 11 let camera = GMSCameraPosition.camera(withLatitude: 35.681236, longitude: 139.767125, zoom: 2.0) 12 13 //CGRect.zero,view.frame 14 let mapView = GMSMapView.map(withFrame: view.bounds, camera: camera) 15 self.view = mapView 16 let marker = GMSMarker() 17 marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20) 18 marker.title = "Sydney" 19 marker.snippet = "Australia" 20 marker.map = mapView 21 //self.view.backgroundColor = .red 22 } 23}
Podfile
1//podfile 2target 'Gmap_test' do 3 # Comment the next line if you don't want to use dynamic frameworks 4 use_frameworks! 5 6 #Pods for Gmap_test 7 pod 'GoogleMaps' 8 pod 'GooglePlaces' 9 10end
###エラー
エラーは表示されていないです。
回答1件
あなたの回答
tips
プレビュー