I have this app and I want to use google maps or apple maps to open when the user presses a button in my app. How would I be able to do this? Is there like a link to the maps that opens the app or is it something else? If you can point me in the right direction it would be really helpful. Thanks! I have the button set up below like this:
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
for touch in (touches ) {
let location = touch.locationInNode(self)
let node = self.nodeAtPoint(location)
if node.name == "openMaps" {
//code to open google maps or apple maps....
}
Use this:
You can find more info about the google maps URL scheme here
Edit: You must add a key to your
info.plist
for this to work.Edit: Per updated Google Maps docs added "googlechromes" to plist above also.
At button click (in action) call function "directions()" with following code :
Edit your info.plist for LSApplicationQueriesSchemes :
Hope will help!