teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

更新

2018/05/26 07:18

投稿

clo.momo
clo.momo

スコア27

title CHANGED
File without changes
body CHANGED
@@ -4,8 +4,41 @@
4
4
 
5
5
  このサイトを参考にしています。 [位置情報を正確にトラッキングする技術 in iOS — (第2回)位置情報の取得](https://medium.com/location-tracking-tech/tracking-location-in-ios-vol-2-%E4%BD%8D%E7%BD%AE%E6%83%85%E5%A0%B1%E3%81%AE%E5%8F%96%E5%BE%97-c68c47548134)
6
6
 
7
+ これはボクのXcodenoです
8
+ 書いてるファイルが間違ってたりするかもしれないので、画像を載せてみました
9
+ ![Xcodeの画像](f751db31f82f294fb802aeb2bdbaf2f2.png)
7
10
 
11
+ ファイル名
12
+ 現在のコード
8
13
  ```Swift
14
+ import UIKit
15
+ import CoreLocation
16
+
17
+ class LocationService: NSObject, CLLocationManagerDelegate {
18
+
19
+ let locationManager = CLLocationManager()
20
+
21
+ override init() {
22
+
23
+ locationManager.desiredAccuracy = kCLLocationAccuracyKilometer
24
+ locationManager.requestWhenInUseAuthorization()
25
+
26
+ super.init()
27
+ locationManager.delegate = self
28
+ locationManager.startUpdatingLocation()
29
+ }
30
+
31
+ func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]){
32
+
33
+ if let newLocation = locations.last {
34
+ print("((newLocation.coordinate.latitude),(newLocation.coordinate.latitude))")
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ 最初のコード
41
+ ```Swift
9
42
  import Foundation
10
43
  import CoreLocation
11
44