Help us understand the problem. What is going on with this article?

Google Maps swift2.0

More than 5 years have passed since last update.

Dependencies

swift >= 2.0
Deployment Target == 9.1

Google Maps SDK for IOS
1. API Keyの取得
2. Google Maps SDK のインストール

Build Settings > Build Options > Enable Bitcode をNoにする。
( error: linker command failed with exit code 1 )

AppDelegate.swift
import UIKit
import GoogleMaps

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?
  let cGoogleMapsAPIKey = "==API_KEY=============================="

  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    GMSServices.provideAPIKey(cGoogleMapsAPIKey)
    return true
  }

  func applicationWillResignActive(application: UIApplication) {}
  func applicationDidEnterBackground(application: UIApplication) {}
  func applicationWillEnterForeground(application: UIApplication) {}
  func applicationDidBecomeActive(application: UIApplication) {}
  func applicationWillTerminate(application: UIApplication) {}
}
ViewController.swift
import UIKit
import GoogleMaps

class ViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()

    let camera = GMSCameraPosition.cameraWithLatitude(-33.868,
      longitude:151.2086, zoom:6)
    let mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)

    let marker = GMSMarker()
    marker.position = camera.target
    marker.snippet = "Hello World"
    marker.appearAnimation = kGMSMarkerAnimationPop
    marker.map = mapView

    self.view = mapView
  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
  }
}
muchi_ko
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away