Date post: | 10-Jul-2015 |
Category: |
Software |
Upload: | hitesh-kumar-singh |
View: | 178 times |
Download: | 1 times |
Integrate Google Map SDK
iOS App
• Get iOS API Key
• Integrate Google Map SDK
Go to this link
• https://developers.google.com/maps/documentation/ios-sdk/
Click on Get a Key
Click on Continue
You would be redirected to new page
Create your project with bundle identifier
You will get your API Key
Copy API Key
Getting started with Google Map SDK
• https://developers.google.com/maps/documentation/ios-sdk/start -step_1_get_the_latest_version_of_xcode
Install API using CocoaPods
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
AppDelegate.swift
• Import GoogleMaps
• In didFinishLaunchWithOptions function add this line with your API key.
GMSServices.provideAPIKey(“Your API key”)
ViewController.swift - add it to viewDidLoad()
let camera = GMSCameraPosition.cameraWithLatitude(-33.86, longitude: 151.20, zoom: 6)
let mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
mapView.myLocationEnabled = trueself.view = mapViewlet marker = GMSMarker()marker.position = CLLocationCoordinate2DMake(-33.86, 151.20)marker.title = "Sydney”marker.snippet = "Australia”marker.map = mapView
With iOS9 and XCode7 – add this to your info.plist file<key>LSApplicationQueriesSchemes</key><array> <string>googlechromes</string> <string>comgooglemaps</string></array>
Run your project
Reference
• https://developers.google.com/maps/documentation/ios-sdk/
• https://developers.google.com/maps/documentation/ios-sdk/start -step_1_get_the_latest_version_of_xcode
Reach me
• https://twitter.com/maverickhitesh
• https://in.linkedin.com/in/maverickhitesh
• https://www.facebook.com/MaverickHitesh