【问题标题】: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
【解决方案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);
}