【问题标题】:Getting Current Location's Provider Detail in iPhone在 iPhone 中获取当前位置提供程序详细信息
【发布时间】:2011-05-10 11:38:15
【问题描述】:

我已经实现了LocationManager 并在didUpdateToLocation: 中更新了当前位置,一切正常。现在我想实现网络三角测量,据我所知,位置服务会自动执行此操作。只需在您的LocationManager 中请求“最佳精度”,如果 GPS 不可用或不稳定,它将进行网络三角测量。

问题是我想获取位置提供者(GPS、网络),即提供位置的位置提供者。如何在我的应用程序中获取位置的提供者详细信息。

【问题讨论】:

    标签: iphone ios ios4 core-location


    【解决方案1】:

    在这里查看我的答案:Corelocation and assisted gps iPhone

    这应该可以帮助您区分 GPS 和三角测量。

    【讨论】:

      【解决方案2】:
      #import <UIKit/UIKit.h> 
      #import <CoreLocation/CoreLocation.h>
      
      @interface RootViewController : UIViewController<CLLocationManagerDelegate>
      
      { 
      
      CLLocationManager   *locationManager;
      
      
      } 
      @property (nonatomic, retain) CLLocationManager *locationManager;
      
       @end
      
      
      
      
      The implementation of our view controller is as follows:
      #import "RootViewController.h"
       #import <objc/runtime.h>
      
      @implementation RootViewController
      
      @synthesize locationManager;
      
      - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation
      {
      
      NSLog(@"Latitude = %f", newLocation.coordinate.latitude);
      
      
       NSLog(@"Longitude = %f", newLocation.coordinate.longitude);
      
      }
      

      【讨论】:

      • 我们如何知道当前位置来自 GPS 或网络??
      猜你喜欢
      • 2012-11-30
      • 1970-01-01
      • 2021-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 2017-01-12
      • 1970-01-01
      相关资源
      最近更新 更多