回答編集履歴
2
修正しました。
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
var locationManager = CLLocationManager()
|
26
26
|
|
27
|
-
var locationData:CLLocation? // ここに宣言を追加
|
27
|
+
var locationData:CLLocation? = nil // ここに宣言を追加
|
28
28
|
|
29
29
|
|
30
30
|
|
@@ -42,6 +42,24 @@
|
|
42
42
|
|
43
43
|
}
|
44
44
|
|
45
|
+
|
46
|
+
|
47
|
+
override func viewDidLoad() {
|
48
|
+
|
49
|
+
super.viewDidLoad()
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
....
|
54
|
+
|
55
|
+
if let locationData = locationData, locationData.coordinate.latitude >= 35.689634 {
|
56
|
+
|
57
|
+
scene.rootNode.addChildNode(sphere3Node)
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
45
63
|
}
|
46
64
|
|
47
65
|
```
|
1
編集しました
test
CHANGED
@@ -8,27 +8,41 @@
|
|
8
8
|
|
9
9
|
```
|
10
10
|
|
11
|
+
import SceneKit
|
12
|
+
|
13
|
+
import ARKit
|
14
|
+
|
15
|
+
import CoreLocation
|
16
|
+
|
17
|
+
import UIKit
|
18
|
+
|
19
|
+
|
20
|
+
|
11
21
|
class ViewController: UIViewController, ARSCNViewDelegate, CLLocationManagerDelegate{
|
12
22
|
|
13
23
|
|
14
24
|
|
15
|
-
var locationManager = CLLocationManager()
|
25
|
+
var locationManager = CLLocationManager()
|
16
26
|
|
17
27
|
var locationData:CLLocation? // ここに宣言を追加
|
18
28
|
|
19
29
|
|
20
30
|
|
31
|
+
|
32
|
+
|
21
|
-
|
33
|
+
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]){
|
22
34
|
|
23
35
|
|
24
36
|
|
25
|
-
|
37
|
+
// ここで値を代入する
|
26
38
|
|
39
|
+
locationData = locations.last
|
27
40
|
|
41
|
+
...
|
28
42
|
|
29
|
-
|
43
|
+
}
|
30
44
|
|
31
|
-
|
45
|
+
}
|
32
46
|
|
33
47
|
```
|
34
48
|
|