Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Open Apple Maps from within Unity app

Discussion in 'iOS and tvOS' started by Metron, Oct 17, 2018.

  1. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Hi,

    In one of our applications, we have to open Apple Maps to guide the user to a specific place in town.

    On Android, we simply do this:

    Code (CSharp):
    1. Application.OpenURL("http://maps.google.com/maps?q=London");
    Unfortunately, this doesn't seem to work on iOS (12.0.1). Can anyone tell me how to do this?

    Thanks for your help.
     
  2. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,116
    You will have to use "maps.apple.com" for Apple.
    Tested with 12.0.1 (iPhone) and 11.3.1 (iPad) right now.

    Code (CSharp):
    1. #if UNITY_ANDROID
    2.         Application.OpenURL("google.navigation:q=New+York+Time+Square");
    3. #elif UNITY_IOS
    4.         Application.OpenURL("http://maps.apple.com/maps?saddr=Current+Location&daddr=New+York+Time+Square");
    5. #else
    6.         Application.OpenURL("http://maps.google.com/maps?saddr=My+Location&daddr=New+York+Time+Square");
    7. #endif
    Hope it helps.
     
    N4TUR1NO and HYPERSONICs like this.
  3. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
  4. Nabil_fx

    Nabil_fx

    Joined:
    Nov 9, 2013
    Posts:
    124
    Im using, but show this error.
    Unexpected symbol `{'

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5.  
    6. public class appopen : MonoBehaviour {
    7.  
    8.     public void urlLink (
    9.     {
    10.     Application.OpenURL("http://maps.google.com/maps?q=London");
    11.         }
    12.         }
    13.  
     
  5. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Missing ) behind urllink(
     
  6. gringofxs

    gringofxs

    Joined:
    Oct 14, 2012
    Posts:
    240
    Thank you