获取当前位置';iPhone中的供应商详细信息
我已经实现了获取当前位置';iPhone中的供应商详细信息,iphone,ios,ios4,core-location,Iphone,Ios,Ios4,Core Location,我已经实现了LocationManager,并在didUpdateToLocation:中获得了当前位置的更新,一切正常。现在我想实现网络三角测量,据我所知,定位服务会自动完成这项工作。只需在您的LocationManager中请求“最佳精度”,如果GPS不可用或不稳定,它将进行网络三角测量 问题是我想获得位置的提供者(GPS、网络),即哪个位置提供者提供位置。如何在我的应用程序中获取位置的提供者详细信息。\import #import <UIKit/UIKit.h> #impor
LocationManager
,并在didUpdateToLocation:
中获得了当前位置的更新,一切正常。现在我想实现网络三角测量,据我所知,定位服务会自动完成这项工作。只需在您的LocationManager中请求“最佳精度”,如果GPS不可用或不稳定,它将进行网络三角测量
问题是我想获得位置的提供者(GPS、网络),即哪个位置提供者提供位置。如何在我的应用程序中获取位置的提供者详细信息。\import
#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);
}
#进口
@接口RootViewController:UIViewController
{
CLLocationManager*locationManager;
}
@财产(非原子,保留)CLLocationManager*locationManager;
@结束
我们的视图控制器的实现如下所示:
#导入“RootViewController.h”
#进口
@RootViewController的实现
@综合定位经理;
-(void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation
{
NSLog(@“纬度=%f”,newLocation.coordinate.Latitude);
NSLog(@“经度=%f”,newLocation.coordinate.Longitude);
}
在这里查看我的答案:
这将帮助您区分GPS和三角测量。我们如何知道当前位置来自GPS或网络??