質問編集履歴

5

コードの修正

2019/09/25 05:29

投稿

AtsushiNakamura
AtsushiNakamura

スコア46

test CHANGED
File without changes
test CHANGED
@@ -66,7 +66,7 @@
66
66
 
67
67
 
68
68
 
69
- pedometer.queryPedometerData(from: from, to: to, withHandler: {(pedometerData, error) in
69
+ pedometer.queryPedometerData(from: start, to: end, withHandler: {(pedometerData, error) in
70
70
 
71
71
  print("歩数は(pedometerData!.numberOfSteps)")
72
72
 

4

コードの修正

2019/09/25 05:29

投稿

AtsushiNakamura
AtsushiNakamura

スコア46

test CHANGED
File without changes
test CHANGED
@@ -40,9 +40,29 @@
40
40
 
41
41
  }
42
42
 
43
- let from = Date(timeIntervalSinceNow: -10000)//-10000は適当な数字です。適宜最適な数字に書き換えてください。
44
43
 
44
+
45
+ let from = Date(timeInterval: TimeInterval(-60*60*24*0), since: now)
46
+
47
+ var component = NSCalendar.current.dateComponents([.year, .month, .day], from: from)
48
+
49
+ component.hour = 0
50
+
51
+ component.minute = 0
52
+
53
+ component.second = 0
54
+
55
+ let start:NSDate = NSCalendar.current.date(from:component)! as NSDate
56
+
45
- let to = Date()//現在取得してます。
57
+ //XX月XX日23時59分59秒に設定したものendにいれる
58
+
59
+ component.hour = 23
60
+
61
+ component.minute = 59
62
+
63
+ component.second = 59
64
+
65
+ let end:NSDate = NSCalendar.current.date(from:component)! as NSDate
46
66
 
47
67
 
48
68
 

3

2019/09/25 05:27

投稿

AtsushiNakamura
AtsushiNakamura

スコア46

test CHANGED
File without changes
test CHANGED
File without changes

2

2019/09/25 01:32

投稿

AtsushiNakamura
AtsushiNakamura

スコア46

test CHANGED
File without changes
test CHANGED
File without changes

1

2019/09/25 01:31

投稿

AtsushiNakamura
AtsushiNakamura

スコア46

test CHANGED
File without changes
test CHANGED
File without changes