// 应用程序,可以添加Core Location框架所包含的类,获取设备的地理位置
// 添加CoreLocation.framework框架,导入#import<Corelocaton/Corelocation.h>
// 使用地图服务,会消耗设备的电量,因此在设备获取到位置后,应该停止定位
定位获取位置及位置编码-反编码
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
@interface RootViewController :UIViewController<CLLocationManagerDelegate>
@end
#import "RootViewController.h"
#import <AddressBook/AddressBook.h>
@interface RootViewController ()
{
CLLocationManager * _locationManager;
}
@end
@implementation RootViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[superviewDidLoad];
// Do any additional setup after loading the view.
[selfcreateGPSMap];
self.view.backgroundColor = [UIColoryellowColor];