using UnityEngine; using System.Runtime.InteropServices; using AOT; using System; public class LocationPluginInterface { #if UNITY_IOS // 访问本地插件接口的声明 [DllImport("__Internal")] private static extern bool _startUpdatingLocation(IntPtr resultHandler); [DllImport ("__Internal")] private static extern void _stopUpdatingLocation(); #endif // 开始获取位置信息 public static bool StartUpdatingLocation(IntPtr resultHandler) { #if !UNITY_EDITOR && UNITY_IOS return _startUpdatingLocation(resultHandler); #else return false; #endif } // 停止获取位置信息 public static void StopUpdatingLocation() { #if !UNITY_EDITOR && UNITY_IOS _stopUpdatingLocation(); #endif } }