Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions LocationSample/LocationSample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ class ViewController: UIViewController, CLLocationManagerDelegate {

/* 位置情報取得成功時に実行される関数 */
func locationManager(manager: CLLocationManager, didUpdateToLocation newLocation: CLLocation, fromLocation oldLocation: CLLocation){
let Photolocationlatiitude = 37.33240905
let Photolocationlongitude = -122.03051211

// 取得した緯度がnewLocation.coordinate.longitudeに格納されている
let lat = newLocation.coordinate.latitude
// 取得した経度がnewLocation.coordinate.longitudeに格納されている
let long = newLocation.coordinate.longitude
// 取得した緯度・経度をLogに表示
print("latiitude: \(lat) , longitude: \(long)")
print("Photolocationlatiitude: \(Photolocationlatiitude), Photolocationlongitude: \(Photolocationlongitude),\n latiitude: \(lat) , longitude: \(long)")

// GPSの使用を停止する.停止しない限りGPSは実行され,指定間隔で更新され続ける.
// lm.stopUpdatingLocation()
Expand All @@ -62,7 +65,7 @@ class ViewController: UIViewController, CLLocationManagerDelegate {
/* 位置情報取得失敗時に実行される関数 */
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
// この例ではLogにErrorと表示するだけ.
print("Error")
print(error)
}

}