diff --git a/src/ios/AppDelegate.swift b/src/ios/AppDelegate.swift index 8735627d5..87e524b2f 100644 --- a/src/ios/AppDelegate.swift +++ b/src/ios/AppDelegate.swift @@ -62,7 +62,7 @@ var pedometer = CMPedometer() } else { sender = "PHONE" } - Server.server?.send("SENDER=\(sender)#HR=\(WatchKitConnection.currentHeartRate)#ODO=\(distance)") + Server.server?.send("SENDER=\(sender)#HR=\(WatchKitConnection.currentHeartRate)#ODO=\(distance)#") WatchKitConnection.distance = distance; } @@ -74,7 +74,7 @@ var pedometer = CMPedometer() } else { sender = "PHONE" } - Server.server?.send("SENDER=\(sender)#HR=\(WatchKitConnection.currentHeartRate)#KCAL=\(kcal)") + Server.server?.send("SENDER=\(sender)#HR=\(WatchKitConnection.currentHeartRate)#KCAL=\(kcal)#") WatchKitConnection.kcal = kcal; } diff --git a/src/ios/AppleWatchToIpad/Connection.swift b/src/ios/AppleWatchToIpad/Connection.swift index 0769d0201..4c1b84b25 100644 --- a/src/ios/AppleWatchToIpad/Connection.swift +++ b/src/ios/AppleWatchToIpad/Connection.swift @@ -68,11 +68,13 @@ class Connection { if sender?.contains("PHONE") ?? false && message.contains("HR=") { let hr : String = message.slice(from: "HR=", to: "#") ?? "" WatchKitConnection.currentHeartRate = (Int(hr) ?? 0) - } else if sender?.contains("PAD") ?? false && message.contains("KCAL=") { + } + if sender?.contains("PAD") ?? false && message.contains("KCAL=") { let kcal : String = message.slice(from: "KCAL=", to: "#") ?? "" - WatchKitConnection.kcal = (Int(kcal) ?? 0) - } else if sender?.contains("PAD") ?? false && message.contains("ODO=") { - let kcal : String = message.slice(from: "ODO=", to: "#") ?? "" + WatchKitConnection.kcal = (Double(kcal) ?? 0) + } + if sender?.contains("PAD") ?? false && message.contains("ODO=") { + let odo : String = message.slice(from: "ODO=", to: "#") ?? "" WatchKitConnection.distance = (Double(odo) ?? 0) } }