Manos Chorianopoulos

fix open maps

...@@ -237,19 +237,26 @@ import MapKit ...@@ -237,19 +237,26 @@ import MapKit
237 // return 237 // return
238 // } 238 // }
239 239
240 - guard let googleMapsUrl = URL(string: "https://www.google.co.in/maps/dir/?saddr=&daddr=\(lat),\(lon)&directionsmode=driving"), 240 +// guard let googleMapsUrl = URL(string: "https://www.google.co.in/maps/dir/?saddr=&daddr=\(lat),\(lon)&directionsmode=driving"),
241 - let appleMapsUrl = URL(string: "http://maps.apple.com/?daddr=\(lat),\(lon)") else { 241 +// let appleMapsUrl = URL(string: "http://maps.apple.com/?daddr=\(lat),\(lon)") else {
242 +// print("Error creating URLs")
243 +// return
244 +// }
245 +//
246 +// // check if link can be opened with google maps.
247 +// guard UIApplication.shared.canOpenURL(googleMapsUrl) else {
248 +// UIApplication.shared.open(appleMapsUrl, options: [:], completionHandler: nil)
249 +// return
250 +// }
251 +//
252 +// UIApplication.shared.open(googleMapsUrl, options: [:], completionHandler: nil)
253 +
254 + guard let appleMapsUrl = URL(string: "http://maps.apple.com/?daddr=\(lat),\(lon)") else {
242 print("Error creating URLs") 255 print("Error creating URLs")
243 return 256 return
244 } 257 }
245 258
246 - // check if link can be opened with google maps. 259 + UIApplication.shared.open(appleMapsUrl, options: [:], completionHandler: nil)
247 - guard UIApplication.shared.canOpenURL(googleMapsUrl) else {
248 - UIApplication.shared.open(appleMapsUrl, options: [:], completionHandler: nil)
249 - return
250 - }
251 -
252 - UIApplication.shared.open(googleMapsUrl, options: [:], completionHandler: nil)
253 260
254 } 261 }
255 262
......