├── mapkit.gif ├── mapkit ├── Images.xcassets │ ├── btn_map_locate_hl.imageset │ │ ├── btn_map_locate_hl.png │ │ ├── btn_map_locate_hl@2x.png │ │ └── Contents.json │ ├── map_locate_blue.imageset │ │ ├── map_locate_blue@2x.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Myanotation.m ├── ViewController.h ├── AppDelegate.h ├── main.m ├── Myanotation.h ├── Info.plist ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard └── ViewController.m ├── mapkit.xcodeproj ├── xcuserdata │ └── huangzhenyu.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── mapkit.xcscheme ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ └── huangzhenyu.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── mapkit.xccheckout └── project.pbxproj ├── README.md ├── .gitignore ├── locationGPS.h ├── mapkitTests ├── Info.plist └── mapkitTests.m ├── LocationManager.h ├── locationGPS.m └── LocationManager.m /mapkit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chennyhuang/mapkit/HEAD/mapkit.gif -------------------------------------------------------------------------------- /mapkit/Images.xcassets/btn_map_locate_hl.imageset/btn_map_locate_hl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chennyhuang/mapkit/HEAD/mapkit/Images.xcassets/btn_map_locate_hl.imageset/btn_map_locate_hl.png -------------------------------------------------------------------------------- /mapkit/Images.xcassets/map_locate_blue.imageset/map_locate_blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chennyhuang/mapkit/HEAD/mapkit/Images.xcassets/map_locate_blue.imageset/map_locate_blue@2x.png -------------------------------------------------------------------------------- /mapkit.xcodeproj/xcuserdata/huangzhenyu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /mapkit/Images.xcassets/btn_map_locate_hl.imageset/btn_map_locate_hl@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chennyhuang/mapkit/HEAD/mapkit/Images.xcassets/btn_map_locate_hl.imageset/btn_map_locate_hl@2x.png -------------------------------------------------------------------------------- /mapkit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mapkit 2 | 本demo仅供学习使用 3 | 4 | 5 | 1.实现定位功能,需要在plist文件配置相关参数(参考locationGPS.h)。 6 | 7 | 8 | 9 | 2.测距(封装了地理编码,反地理编码,经纬度测距功能,参考LocationManager.h)。 10 | 11 | 12 | ![image](https://github.com/chennyhuang/mapkit/blob/master/mapkit.gif) -------------------------------------------------------------------------------- /mapkit.xcodeproj/project.xcworkspace/xcuserdata/huangzhenyu.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chennyhuang/mapkit/HEAD/mapkit.xcodeproj/project.xcworkspace/xcuserdata/huangzhenyu.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /mapkit/Myanotation.m: -------------------------------------------------------------------------------- 1 | // 2 | // anotation.m 3 | // mapkit 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import "Myanotation.h" 10 | 11 | @implementation Myanotation 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /mapkit/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // mapkit 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /mapkit/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // mapkit 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /mapkit/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // mapkit 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mapkit/Images.xcassets/map_locate_blue.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "map_locate_blue@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mapkit/Images.xcassets/btn_map_locate_hl.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "btn_map_locate_hl.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "btn_map_locate_hl@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /mapkit/Myanotation.h: -------------------------------------------------------------------------------- 1 | // 2 | // anotation.h 3 | // mapkit 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | @interface Myanotation : NSObject 12 | @property (nonatomic, assign) CLLocationCoordinate2D coordinate; 13 | @property (nonatomic, copy) NSString *title; 14 | @property (nonatomic, copy) NSString *subtitle; 15 | @property (nonatomic, copy) NSString *icon; 16 | @end 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | build/ 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | *.xccheckout 13 | *.moved-aside 14 | DerivedData 15 | *.hmap 16 | *.ipa 17 | *.xcuserstate 18 | libDBPlayer.release.a 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /mapkit.xcodeproj/xcuserdata/huangzhenyu.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | mapkit.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | EE6DD9411B0B09070029B102 16 | 17 | primary 18 | 19 | 20 | EE6DD95A1B0B09070029B102 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /mapkit/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /locationGPS.h: -------------------------------------------------------------------------------- 1 | // 2 | // locationGPS.h 3 | // 114宅便民商户助手 4 | // 5 | // Created by huangzhenyu on 14-11-20. 6 | // Copyright (c) 2014年 keysense. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @interface locationGPS : NSObject 14 | + (instancetype)sharedlocationGPS; 15 | @property (strong, nonatomic) CLLocationManager *locationManager; 16 | @property (nonatomic,assign) double longitude;//经度 17 | @property (nonatomic,assign) double latitude;//纬度 18 | //定位结束的回调 19 | @property (nonatomic,strong) void(^locationCompleteBlock)(double longitude,double latitude); 20 | - (void)getAuthorization;//授权 21 | //- (void)alertOpenLocationSwitch;//提示用户打开定位开关 22 | - (void)startLocation;//点击某个按钮开始定位 23 | @end 24 | -------------------------------------------------------------------------------- /mapkitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.eamon.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /mapkitTests/mapkitTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // mapkitTests.m 3 | // mapkitTests 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface mapkitTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation mapkitTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LocationManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // LocationManager.h 3 | // cllo 4 | // 5 | // Created by huangzhenyu on 14-11-19. 6 | // Copyright (c) 2014年 keysense. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface LocationManager : NSObject 13 | 14 | /** 15 | * 地理编码 (通过地址获取经纬度) 16 | * 17 | * @param address 输入的地址 18 | * @param success 成功block,返回pm 19 | * @param failure 失败block 20 | */ 21 | - (void)geocode:(NSString *)address success:(void(^)(CLPlacemark *pm))success failure:(void(^)())failure; 22 | 23 | 24 | /** 25 | * 反地理编码 (通过经纬度获取地址) 26 | * 27 | * @param latitude 输入的纬度 28 | * @param longitude 输入经度 29 | * @param success 成功block,返回pm 30 | * @param failure 失败block 31 | */ 32 | - (void)reverseGeocodeWithlatitude:(CLLocationDegrees )latitude longitude:(CLLocationDegrees)longitude success:(void(^)(NSString *address))success failure:(void(^)())failure; 33 | 34 | /** 35 | * 经纬度计算两地之间距离 36 | * 37 | * @param lon1 目标的的经度 38 | * @param lat1 目标的纬度 39 | * @param lon2 自己的经度 40 | * @param lat2 自己的纬度 41 | * @param 返回值 距离(米) 42 | */ 43 | -(double) LantitudeLongitudeDist:(double)lon1 other_Lat:(double)lat1 self_Lon:(double)lon2 self_Lat:(double)lat2; 44 | 45 | 46 | - (double)countLineDistanceDest:(double)lon1 dest_Lat:(double)lat1 self_Lon:(double)lon2 self_Lat:(double)lat2; 47 | @end 48 | -------------------------------------------------------------------------------- /mapkit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.eamon.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | NSLocationWhenInUseUsageDescription 31 | 测试 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UIMainStoryboardFile 35 | Main 36 | UIRequiredDeviceCapabilities 37 | 38 | armv7 39 | 40 | UISupportedInterfaceOrientations 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /mapkit.xcodeproj/project.xcworkspace/xcshareddata/mapkit.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | D3ACF0B8-775B-4EF2-BDBF-F565478DAA87 9 | IDESourceControlProjectName 10 | mapkit 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 99930C2A1C1D7BD7E6269C0344A7C5FB5E47EEA0 14 | https://github.com/chennyhuang/mapkit.git 15 | 16 | IDESourceControlProjectPath 17 | mapkit.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 99930C2A1C1D7BD7E6269C0344A7C5FB5E47EEA0 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/chennyhuang/mapkit.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 99930C2A1C1D7BD7E6269C0344A7C5FB5E47EEA0 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 99930C2A1C1D7BD7E6269C0344A7C5FB5E47EEA0 36 | IDESourceControlWCCName 37 | mapkit 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /mapkit/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // mapkit 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /locationGPS.m: -------------------------------------------------------------------------------- 1 | // 2 | // locationGPS.m 3 | // 114宅便民商户助手 4 | // 5 | // Created by huangzhenyu on 14-11-20. 6 | // Copyright (c) 2014年 keysense. All rights reserved. 7 | // 8 | 9 | #import "locationGPS.h" 10 | 11 | @implementation locationGPS 12 | +(instancetype)sharedlocationGPS 13 | { 14 | static locationGPS * _sharedGps = nil; 15 | static dispatch_once_t onceToken; 16 | dispatch_once(&onceToken, ^{ 17 | _sharedGps = [[locationGPS alloc] init]; 18 | }); 19 | return _sharedGps; 20 | } 21 | 22 | 23 | //kCLAuthorizationStatusNotDetermined: 用户尚未做出决定是否启用定位服务 24 | //kCLAuthorizationStatusRestricted: 没有获得用户授权使用定位服务 25 | //kCLAuthorizationStatusDenied :用户已经明确禁止应用使用定位服务或者当前系统定位服务处于关闭状态 26 | //kCLAuthorizationStatusAuthorizedAlways: 应用获得授权可以一直使用定位服务,即使应用不在使用状态 27 | //kCLAuthorizationStatusAuthorizedWhenInUse: 使用此应用过程中允许访问定位服务 28 | - (void)getAuthorization 29 | { 30 | if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { 31 | 32 | switch ([CLLocationManager authorizationStatus]) { 33 | case kCLAuthorizationStatusAuthorizedAlways: 34 | case kCLAuthorizationStatusAuthorizedWhenInUse: 35 | break; 36 | 37 | case kCLAuthorizationStatusNotDetermined: 38 | [self.locationManager requestWhenInUseAuthorization]; 39 | break; 40 | case kCLAuthorizationStatusDenied: 41 | [self alertOpenLocationSwitch]; 42 | break; 43 | default: 44 | break; 45 | } 46 | } 47 | 48 | } 49 | 50 | - (void)alertOpenLocationSwitch 51 | { 52 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请在隐私设置中打开定位开关" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; 53 | [alert show]; 54 | } 55 | 56 | - (void)startLocation 57 | { 58 | [_locationManager startUpdatingLocation]; 59 | } 60 | 61 | #pragma mark - LocationManager 62 | - (CLLocationManager *)locationManager 63 | { 64 | if (!_locationManager) { 65 | _locationManager = [[CLLocationManager alloc] init]; 66 | _locationManager.delegate = self; 67 | _locationManager.desiredAccuracy = kCLLocationAccuracyBest;//定位精确度 68 | _locationManager.distanceFilter = 10;//10米定位一次 69 | } 70 | return _locationManager; 71 | } 72 | 73 | #pragma mark -locationManager delegate 74 | //- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status 75 | //{ 76 | // if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse) { 77 | // [manager startUpdatingLocation]; 78 | // } 79 | //} 80 | 81 | #pragma mark 跟踪定位代理方法,每次位置发生变化即会执行(只要定位到相应位置) 82 | - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations 83 | { 84 | CLLocation *location = [locations lastObject]; 85 | //取出经纬度 86 | CLLocationCoordinate2D coordinate = location.coordinate; 87 | _longitude = coordinate.longitude; 88 | _latitude = coordinate.latitude; 89 | // 3.打印经纬度 90 | NSLog(@"didUpdateLocations------%f %f", coordinate.latitude, coordinate.longitude); 91 | if (self.locationCompleteBlock) { 92 | self.locationCompleteBlock(_longitude,_latitude); 93 | } 94 | [_locationManager stopUpdatingLocation];//停止定位 95 | } 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /mapkit/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LocationManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // LocationManager.m 3 | // cllo 4 | // 5 | // Created by huangzhenyu on 14-11-19. 6 | // Copyright (c) 2014年 keysense. All rights reserved. 7 | // 8 | 9 | #import "LocationManager.h" 10 | #define PI 3.141592653 11 | @interface LocationManager() 12 | @property (nonatomic,strong) CLGeocoder *geocoder; 13 | 14 | @end 15 | 16 | @implementation LocationManager 17 | 18 | - (CLGeocoder *)geocoder 19 | { 20 | if (!_geocoder) { 21 | _geocoder = [[CLGeocoder alloc] init]; 22 | } 23 | return _geocoder; 24 | } 25 | 26 | #pragma mark - 地理编码 27 | - (void)geocode:(NSString *)address success:(void(^)(CLPlacemark *pm))success failure:(void(^)())failure 28 | { 29 | [self.geocoder geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) { 30 | if (error) { 31 | if (failure) { 32 | failure(); 33 | } 34 | } else {// 编码成功 35 | //取出最前面的地址 36 | CLPlacemark *pm = [placemarks firstObject]; 37 | if (success) { 38 | success(pm); 39 | } 40 | } 41 | }]; 42 | } 43 | 44 | #pragma mark - 反地理编码 45 | - (void)reverseGeocodeWithlatitude:(CLLocationDegrees )latitude longitude:(CLLocationDegrees)longitude success:(void(^)(NSString *address))success failure:(void(^)())failure 46 | { 47 | 48 | CLLocation *loc = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude]; 49 | [self.geocoder reverseGeocodeLocation:loc completionHandler:^(NSArray *placemarks, NSError *error) { 50 | if (error) { 51 | NSLog(@"%@",error.description); 52 | if (failure) { 53 | failure(); 54 | } 55 | } else { 56 | CLPlacemark *pm = [placemarks firstObject]; 57 | if (success) { 58 | success(pm.name); 59 | } 60 | } 61 | }]; 62 | } 63 | 64 | #pragma mark - 通过经纬度计算距离 65 | -(double) LantitudeLongitudeDist:(double)lon1 other_Lat:(double)lat1 self_Lon:(double)lon2 self_Lat:(double)lat2 66 | { 67 | double er = 6378137; // 6378700.0f; 68 | //ave. radius = 6371.315 (someone said more accurate is 6366.707) 69 | //equatorial radius = 6378.388 70 | //nautical mile = 1.15078 71 | double radlat1 = PI*lat1/180.0f; 72 | double radlat2 = PI*lat2/180.0f; 73 | //now long. 74 | double radlong1 = PI*lon1/180.0f; 75 | double radlong2 = PI*lon2/180.0f; 76 | if( radlat1 < 0 ) radlat1 = PI/2 + fabs(radlat1);// south 77 | if( radlat1 > 0 ) radlat1 = PI/2 - fabs(radlat1);// north 78 | if( radlong1 < 0 ) radlong1 = PI*2 - fabs(radlong1);//west 79 | if( radlat2 < 0 ) radlat2 = PI/2 + fabs(radlat2);// south 80 | if( radlat2 > 0 ) radlat2 = PI/2 - fabs(radlat2);// north 81 | if( radlong2 < 0 ) radlong2 = PI*2 - fabs(radlong2);// west 82 | //spherical coordinates x=r*cos(ag)sin(at), y=r*sin(ag)*sin(at), z=r*cos(at) 83 | //zero ag is up so reverse lat 84 | double x1 = er * cos(radlong1) * sin(radlat1); 85 | double y1 = er * sin(radlong1) * sin(radlat1); 86 | double z1 = er * cos(radlat1); 87 | double x2 = er * cos(radlong2) * sin(radlat2); 88 | double y2 = er * sin(radlong2) * sin(radlat2); 89 | double z2 = er * cos(radlat2); 90 | double d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2)); 91 | //side, side, side, law of cosines and arccos 92 | double theta = acos((er*er+er*er-d*d)/(2*er*er)); 93 | double dist = theta*er; 94 | return dist; 95 | } 96 | 97 | #pragma mark - 系统方法计算距离 98 | - (double)countLineDistanceDest:(double)lon1 dest_Lat:(double)lat1 self_Lon:(double)lon2 self_Lat:(double)lat2 99 | { 100 | //计算2个经纬度之间的直线距离 101 | CLLocation *destloc = [[CLLocation alloc] initWithLatitude:lat1 longitude:lon1]; 102 | CLLocation *selfloc = [[CLLocation alloc] initWithLatitude:lat2 longitude:lon2]; 103 | CLLocationDistance distance = [destloc distanceFromLocation:selfloc]; 104 | return distance; 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /mapkit.xcodeproj/xcuserdata/huangzhenyu.xcuserdatad/xcschemes/mapkit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /mapkit/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // mapkit 4 | // 5 | // Created by huangzhenyu on 15/5/19. 6 | // Copyright (c) 2015年 eamon. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import "locationGPS.h" 12 | #import "Myanotation.h" 13 | #import "LocationManager.h" 14 | 15 | @interface ViewController () 16 | @property (weak, nonatomic) IBOutlet MKMapView *mapView; 17 | - (IBAction)backClick:(UIButton *)sender; 18 | 19 | @property (weak, nonatomic) IBOutlet UILabel *addressLabel; 20 | @property (weak, nonatomic) IBOutlet UILabel *longitudeLabel;//经度 21 | @property (weak, nonatomic) IBOutlet UILabel *latitudeLabel;//纬度 22 | @property (weak, nonatomic) IBOutlet UILabel *distanceLabel; 23 | 24 | @end 25 | 26 | @implementation ViewController 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | locationGPS *loc = [locationGPS sharedlocationGPS]; 31 | [loc getAuthorization];//授权 32 | [loc startLocation];//开始定位 33 | 34 | //跟踪用户位置 35 | self.mapView.userTrackingMode = MKUserTrackingModeFollow; 36 | //地图类型 37 | // self.mapView.mapType = MKMapTypeSatellite; 38 | self.mapView.delegate = self; 39 | 40 | 41 | } 42 | 43 | /** 44 | * 当用户位置更新,就会调用 45 | * 46 | * userLocation 表示地图上面那可蓝色的大头针的数据 47 | */ 48 | - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation 49 | { 50 | CLLocationCoordinate2D center = userLocation.location.coordinate; 51 | userLocation.title = [NSString stringWithFormat:@"经度:%f",center.longitude]; 52 | userLocation.subtitle = [NSString stringWithFormat:@"纬度:%f",center.latitude]; 53 | 54 | NSLog(@"定位:%f %f --- %i",center.latitude,center.longitude,mapView.showsUserLocation); 55 | 56 | if (mapView.showsUserLocation) { 57 | static dispatch_once_t onceToken; 58 | dispatch_once(&onceToken, ^{ 59 | //监听MapView点击 60 | NSLog(@"添加监听"); 61 | [mapView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]]; 62 | }); 63 | } 64 | 65 | 66 | //设置地图的中心点,(以用户所在的位置为中心点) 67 | // [mapView setCenterCoordinate:userLocation.location.coordinate animated:YES]; 68 | 69 | //设置地图的显示范围 70 | // MKCoordinateSpan span = MKCoordinateSpanMake(0.023666, 0.016093); 71 | // MKCoordinateRegion region = MKCoordinateRegionMake(center, span); 72 | // [mapView setRegion:region animated:YES]; 73 | 74 | } 75 | 76 | //- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated 77 | //{ 78 | // //获取跨度 79 | // NSLog(@"%f %f",mapView.region.span.latitudeDelta,mapView.region.span.longitudeDelta); 80 | //} 81 | 82 | - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation 83 | { 84 | //如果是定位的大头针就不用自定义 85 | if (![annotation isKindOfClass:[Myanotation class]]) { 86 | return nil; 87 | } 88 | 89 | static NSString *ID = @"anno"; 90 | MKAnnotationView *annoView = [mapView dequeueReusableAnnotationViewWithIdentifier:ID]; 91 | if (annoView == nil) { 92 | annoView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:ID]; 93 | } 94 | 95 | Myanotation *anno = annotation; 96 | annoView.image = [UIImage imageNamed:@"map_locate_blue"]; 97 | annoView.annotation = anno; 98 | 99 | return annoView; 100 | } 101 | 102 | - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view 103 | { 104 | NSLog(@"didSelectAnnotationView--%@",view); 105 | } 106 | 107 | - (IBAction)backClick:(UIButton *)sender { 108 | [self.mapView setCenterCoordinate:self.mapView.userLocation.coordinate animated:YES]; 109 | } 110 | 111 | - (void)tap:(UITapGestureRecognizer *)tap 112 | { 113 | CGPoint touchPoint = [tap locationInView:tap.view]; 114 | CLLocationCoordinate2D coordinate = [self.mapView convertPoint:touchPoint toCoordinateFromView:self.mapView]; 115 | 116 | NSLog(@"%@",self.mapView.annotations); 117 | NSMutableArray *array = [NSMutableArray array]; 118 | NSUInteger count = self.mapView.annotations.count; 119 | if (count > 1) { 120 | for (id obj in self.mapView.annotations) { 121 | if (![obj isKindOfClass:[MKUserLocation class]]) { 122 | [array addObject:obj]; 123 | } 124 | } 125 | [self.mapView removeAnnotations:array]; 126 | } 127 | MKUserLocation *locationAnno = self.mapView.annotations[0]; 128 | 129 | Myanotation *anno = [[Myanotation alloc] init]; 130 | 131 | anno.coordinate = coordinate; 132 | anno.title = [NSString stringWithFormat:@"经度:%f",coordinate.longitude]; 133 | anno.subtitle = [NSString stringWithFormat:@"纬度:%f",coordinate.latitude]; 134 | 135 | self.longitudeLabel.text = [NSString stringWithFormat:@"经度:%f",coordinate.longitude]; 136 | self.latitudeLabel.text = [NSString stringWithFormat:@"纬度:%f",coordinate.latitude]; 137 | //反地理编码 138 | LocationManager *locManager = [[LocationManager alloc] init]; 139 | [locManager reverseGeocodeWithlatitude:coordinate.latitude longitude:coordinate.longitude success:^(NSString *address) { 140 | self.addressLabel.text = [NSString stringWithFormat:@"%@",address]; 141 | } failure:^{ 142 | 143 | }]; 144 | 145 | //距离 146 | double distance = [locManager countLineDistanceDest:coordinate.longitude dest_Lat:coordinate.latitude self_Lon:locationAnno.coordinate.longitude self_Lat:locationAnno.coordinate.latitude]; 147 | self.distanceLabel.text = [NSString stringWithFormat:@"距您%d米",(int)distance]; 148 | 149 | [self.mapView addAnnotation:anno]; 150 | [self.mapView setCenterCoordinate:coordinate animated:YES]; 151 | } 152 | 153 | @end 154 | -------------------------------------------------------------------------------- /mapkit/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 36 | 46 | 56 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /mapkit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EE6DD9481B0B09070029B102 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6DD9471B0B09070029B102 /* main.m */; }; 11 | EE6DD94B1B0B09070029B102 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6DD94A1B0B09070029B102 /* AppDelegate.m */; }; 12 | EE6DD94E1B0B09070029B102 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6DD94D1B0B09070029B102 /* ViewController.m */; }; 13 | EE6DD9511B0B09070029B102 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE6DD94F1B0B09070029B102 /* Main.storyboard */; }; 14 | EE6DD9531B0B09070029B102 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EE6DD9521B0B09070029B102 /* Images.xcassets */; }; 15 | EE6DD9561B0B09070029B102 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = EE6DD9541B0B09070029B102 /* LaunchScreen.xib */; }; 16 | EE6DD9621B0B09070029B102 /* mapkitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6DD9611B0B09070029B102 /* mapkitTests.m */; }; 17 | EE6DD96C1B0B093F0029B102 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE6DD96B1B0B093F0029B102 /* MapKit.framework */; }; 18 | EE6DD9711B0B0A1E0029B102 /* locationGPS.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6DD96E1B0B0A1E0029B102 /* locationGPS.m */; }; 19 | EE6DD9721B0B0A1E0029B102 /* LocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6DD9701B0B0A1E0029B102 /* LocationManager.m */; }; 20 | EE6DD9751B0B19820029B102 /* Myanotation.m in Sources */ = {isa = PBXBuildFile; fileRef = EE6DD9741B0B19820029B102 /* Myanotation.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | EE6DD95C1B0B09070029B102 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = EE6DD93A1B0B09070029B102 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = EE6DD9411B0B09070029B102; 29 | remoteInfo = mapkit; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | EE6DD9421B0B09070029B102 /* mapkit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = mapkit.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | EE6DD9461B0B09070029B102 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | EE6DD9471B0B09070029B102 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | EE6DD9491B0B09070029B102 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | EE6DD94A1B0B09070029B102 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | EE6DD94C1B0B09070029B102 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 40 | EE6DD94D1B0B09070029B102 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 41 | EE6DD9501B0B09070029B102 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | EE6DD9521B0B09070029B102 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 43 | EE6DD9551B0B09070029B102 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 44 | EE6DD95B1B0B09070029B102 /* mapkitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = mapkitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | EE6DD9601B0B09070029B102 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | EE6DD9611B0B09070029B102 /* mapkitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = mapkitTests.m; sourceTree = ""; }; 47 | EE6DD96B1B0B093F0029B102 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; 48 | EE6DD96D1B0B0A1E0029B102 /* locationGPS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = locationGPS.h; sourceTree = ""; }; 49 | EE6DD96E1B0B0A1E0029B102 /* locationGPS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = locationGPS.m; sourceTree = ""; }; 50 | EE6DD96F1B0B0A1E0029B102 /* LocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocationManager.h; sourceTree = ""; }; 51 | EE6DD9701B0B0A1E0029B102 /* LocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationManager.m; sourceTree = ""; }; 52 | EE6DD9731B0B19820029B102 /* Myanotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Myanotation.h; sourceTree = ""; }; 53 | EE6DD9741B0B19820029B102 /* Myanotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Myanotation.m; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | EE6DD93F1B0B09070029B102 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | EE6DD96C1B0B093F0029B102 /* MapKit.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | EE6DD9581B0B09070029B102 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | /* End PBXFrameworksBuildPhase section */ 73 | 74 | /* Begin PBXGroup section */ 75 | EE6DD9391B0B09070029B102 = { 76 | isa = PBXGroup; 77 | children = ( 78 | EE6DD96D1B0B0A1E0029B102 /* locationGPS.h */, 79 | EE6DD96E1B0B0A1E0029B102 /* locationGPS.m */, 80 | EE6DD96F1B0B0A1E0029B102 /* LocationManager.h */, 81 | EE6DD9701B0B0A1E0029B102 /* LocationManager.m */, 82 | EE6DD96B1B0B093F0029B102 /* MapKit.framework */, 83 | EE6DD9441B0B09070029B102 /* mapkit */, 84 | EE6DD95E1B0B09070029B102 /* mapkitTests */, 85 | EE6DD9431B0B09070029B102 /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | EE6DD9431B0B09070029B102 /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | EE6DD9421B0B09070029B102 /* mapkit.app */, 93 | EE6DD95B1B0B09070029B102 /* mapkitTests.xctest */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | EE6DD9441B0B09070029B102 /* mapkit */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | EE6DD9731B0B19820029B102 /* Myanotation.h */, 102 | EE6DD9741B0B19820029B102 /* Myanotation.m */, 103 | EE6DD9491B0B09070029B102 /* AppDelegate.h */, 104 | EE6DD94A1B0B09070029B102 /* AppDelegate.m */, 105 | EE6DD94C1B0B09070029B102 /* ViewController.h */, 106 | EE6DD94D1B0B09070029B102 /* ViewController.m */, 107 | EE6DD94F1B0B09070029B102 /* Main.storyboard */, 108 | EE6DD9521B0B09070029B102 /* Images.xcassets */, 109 | EE6DD9541B0B09070029B102 /* LaunchScreen.xib */, 110 | EE6DD9451B0B09070029B102 /* Supporting Files */, 111 | ); 112 | path = mapkit; 113 | sourceTree = ""; 114 | }; 115 | EE6DD9451B0B09070029B102 /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | EE6DD9461B0B09070029B102 /* Info.plist */, 119 | EE6DD9471B0B09070029B102 /* main.m */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | EE6DD95E1B0B09070029B102 /* mapkitTests */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | EE6DD9611B0B09070029B102 /* mapkitTests.m */, 128 | EE6DD95F1B0B09070029B102 /* Supporting Files */, 129 | ); 130 | path = mapkitTests; 131 | sourceTree = ""; 132 | }; 133 | EE6DD95F1B0B09070029B102 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | EE6DD9601B0B09070029B102 /* Info.plist */, 137 | ); 138 | name = "Supporting Files"; 139 | sourceTree = ""; 140 | }; 141 | /* End PBXGroup section */ 142 | 143 | /* Begin PBXNativeTarget section */ 144 | EE6DD9411B0B09070029B102 /* mapkit */ = { 145 | isa = PBXNativeTarget; 146 | buildConfigurationList = EE6DD9651B0B09070029B102 /* Build configuration list for PBXNativeTarget "mapkit" */; 147 | buildPhases = ( 148 | EE6DD93E1B0B09070029B102 /* Sources */, 149 | EE6DD93F1B0B09070029B102 /* Frameworks */, 150 | EE6DD9401B0B09070029B102 /* Resources */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = mapkit; 157 | productName = mapkit; 158 | productReference = EE6DD9421B0B09070029B102 /* mapkit.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | EE6DD95A1B0B09070029B102 /* mapkitTests */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = EE6DD9681B0B09070029B102 /* Build configuration list for PBXNativeTarget "mapkitTests" */; 164 | buildPhases = ( 165 | EE6DD9571B0B09070029B102 /* Sources */, 166 | EE6DD9581B0B09070029B102 /* Frameworks */, 167 | EE6DD9591B0B09070029B102 /* Resources */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | EE6DD95D1B0B09070029B102 /* PBXTargetDependency */, 173 | ); 174 | name = mapkitTests; 175 | productName = mapkitTests; 176 | productReference = EE6DD95B1B0B09070029B102 /* mapkitTests.xctest */; 177 | productType = "com.apple.product-type.bundle.unit-test"; 178 | }; 179 | /* End PBXNativeTarget section */ 180 | 181 | /* Begin PBXProject section */ 182 | EE6DD93A1B0B09070029B102 /* Project object */ = { 183 | isa = PBXProject; 184 | attributes = { 185 | LastUpgradeCheck = 0630; 186 | ORGANIZATIONNAME = eamon; 187 | TargetAttributes = { 188 | EE6DD9411B0B09070029B102 = { 189 | CreatedOnToolsVersion = 6.3; 190 | }; 191 | EE6DD95A1B0B09070029B102 = { 192 | CreatedOnToolsVersion = 6.3; 193 | TestTargetID = EE6DD9411B0B09070029B102; 194 | }; 195 | }; 196 | }; 197 | buildConfigurationList = EE6DD93D1B0B09070029B102 /* Build configuration list for PBXProject "mapkit" */; 198 | compatibilityVersion = "Xcode 3.2"; 199 | developmentRegion = English; 200 | hasScannedForEncodings = 0; 201 | knownRegions = ( 202 | en, 203 | Base, 204 | ); 205 | mainGroup = EE6DD9391B0B09070029B102; 206 | productRefGroup = EE6DD9431B0B09070029B102 /* Products */; 207 | projectDirPath = ""; 208 | projectRoot = ""; 209 | targets = ( 210 | EE6DD9411B0B09070029B102 /* mapkit */, 211 | EE6DD95A1B0B09070029B102 /* mapkitTests */, 212 | ); 213 | }; 214 | /* End PBXProject section */ 215 | 216 | /* Begin PBXResourcesBuildPhase section */ 217 | EE6DD9401B0B09070029B102 /* Resources */ = { 218 | isa = PBXResourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | EE6DD9511B0B09070029B102 /* Main.storyboard in Resources */, 222 | EE6DD9561B0B09070029B102 /* LaunchScreen.xib in Resources */, 223 | EE6DD9531B0B09070029B102 /* Images.xcassets in Resources */, 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | EE6DD9591B0B09070029B102 /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXResourcesBuildPhase section */ 235 | 236 | /* Begin PBXSourcesBuildPhase section */ 237 | EE6DD93E1B0B09070029B102 /* Sources */ = { 238 | isa = PBXSourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | EE6DD94E1B0B09070029B102 /* ViewController.m in Sources */, 242 | EE6DD9721B0B0A1E0029B102 /* LocationManager.m in Sources */, 243 | EE6DD94B1B0B09070029B102 /* AppDelegate.m in Sources */, 244 | EE6DD9751B0B19820029B102 /* Myanotation.m in Sources */, 245 | EE6DD9481B0B09070029B102 /* main.m in Sources */, 246 | EE6DD9711B0B0A1E0029B102 /* locationGPS.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | EE6DD9571B0B09070029B102 /* Sources */ = { 251 | isa = PBXSourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | EE6DD9621B0B09070029B102 /* mapkitTests.m in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXTargetDependency section */ 261 | EE6DD95D1B0B09070029B102 /* PBXTargetDependency */ = { 262 | isa = PBXTargetDependency; 263 | target = EE6DD9411B0B09070029B102 /* mapkit */; 264 | targetProxy = EE6DD95C1B0B09070029B102 /* PBXContainerItemProxy */; 265 | }; 266 | /* End PBXTargetDependency section */ 267 | 268 | /* Begin PBXVariantGroup section */ 269 | EE6DD94F1B0B09070029B102 /* Main.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | EE6DD9501B0B09070029B102 /* Base */, 273 | ); 274 | name = Main.storyboard; 275 | sourceTree = ""; 276 | }; 277 | EE6DD9541B0B09070029B102 /* LaunchScreen.xib */ = { 278 | isa = PBXVariantGroup; 279 | children = ( 280 | EE6DD9551B0B09070029B102 /* Base */, 281 | ); 282 | name = LaunchScreen.xib; 283 | sourceTree = ""; 284 | }; 285 | /* End PBXVariantGroup section */ 286 | 287 | /* Begin XCBuildConfiguration section */ 288 | EE6DD9631B0B09070029B102 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ALWAYS_SEARCH_USER_PATHS = NO; 292 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 293 | CLANG_CXX_LIBRARY = "libc++"; 294 | CLANG_ENABLE_MODULES = YES; 295 | CLANG_ENABLE_OBJC_ARC = YES; 296 | CLANG_WARN_BOOL_CONVERSION = YES; 297 | CLANG_WARN_CONSTANT_CONVERSION = YES; 298 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 299 | CLANG_WARN_EMPTY_BODY = YES; 300 | CLANG_WARN_ENUM_CONVERSION = YES; 301 | CLANG_WARN_INT_CONVERSION = YES; 302 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 303 | CLANG_WARN_UNREACHABLE_CODE = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 306 | COPY_PHASE_STRIP = NO; 307 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 308 | ENABLE_STRICT_OBJC_MSGSEND = YES; 309 | GCC_C_LANGUAGE_STANDARD = gnu99; 310 | GCC_DYNAMIC_NO_PIC = NO; 311 | GCC_NO_COMMON_BLOCKS = YES; 312 | GCC_OPTIMIZATION_LEVEL = 0; 313 | GCC_PREPROCESSOR_DEFINITIONS = ( 314 | "DEBUG=1", 315 | "$(inherited)", 316 | ); 317 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 318 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 319 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 320 | GCC_WARN_UNDECLARED_SELECTOR = YES; 321 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 322 | GCC_WARN_UNUSED_FUNCTION = YES; 323 | GCC_WARN_UNUSED_VARIABLE = YES; 324 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 325 | MTL_ENABLE_DEBUG_INFO = YES; 326 | ONLY_ACTIVE_ARCH = YES; 327 | SDKROOT = iphoneos; 328 | }; 329 | name = Debug; 330 | }; 331 | EE6DD9641B0B09070029B102 /* Release */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 351 | ENABLE_NS_ASSERTIONS = NO; 352 | ENABLE_STRICT_OBJC_MSGSEND = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 362 | MTL_ENABLE_DEBUG_INFO = NO; 363 | SDKROOT = iphoneos; 364 | VALIDATE_PRODUCT = YES; 365 | }; 366 | name = Release; 367 | }; 368 | EE6DD9661B0B09070029B102 /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 372 | INFOPLIST_FILE = mapkit/Info.plist; 373 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 374 | PRODUCT_NAME = "$(TARGET_NAME)"; 375 | }; 376 | name = Debug; 377 | }; 378 | EE6DD9671B0B09070029B102 /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 382 | INFOPLIST_FILE = mapkit/Info.plist; 383 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | }; 386 | name = Release; 387 | }; 388 | EE6DD9691B0B09070029B102 /* Debug */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | BUNDLE_LOADER = "$(TEST_HOST)"; 392 | FRAMEWORK_SEARCH_PATHS = ( 393 | "$(SDKROOT)/Developer/Library/Frameworks", 394 | "$(inherited)", 395 | ); 396 | GCC_PREPROCESSOR_DEFINITIONS = ( 397 | "DEBUG=1", 398 | "$(inherited)", 399 | ); 400 | INFOPLIST_FILE = mapkitTests/Info.plist; 401 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mapkit.app/mapkit"; 404 | }; 405 | name = Debug; 406 | }; 407 | EE6DD96A1B0B09070029B102 /* Release */ = { 408 | isa = XCBuildConfiguration; 409 | buildSettings = { 410 | BUNDLE_LOADER = "$(TEST_HOST)"; 411 | FRAMEWORK_SEARCH_PATHS = ( 412 | "$(SDKROOT)/Developer/Library/Frameworks", 413 | "$(inherited)", 414 | ); 415 | INFOPLIST_FILE = mapkitTests/Info.plist; 416 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mapkit.app/mapkit"; 419 | }; 420 | name = Release; 421 | }; 422 | /* End XCBuildConfiguration section */ 423 | 424 | /* Begin XCConfigurationList section */ 425 | EE6DD93D1B0B09070029B102 /* Build configuration list for PBXProject "mapkit" */ = { 426 | isa = XCConfigurationList; 427 | buildConfigurations = ( 428 | EE6DD9631B0B09070029B102 /* Debug */, 429 | EE6DD9641B0B09070029B102 /* Release */, 430 | ); 431 | defaultConfigurationIsVisible = 0; 432 | defaultConfigurationName = Release; 433 | }; 434 | EE6DD9651B0B09070029B102 /* Build configuration list for PBXNativeTarget "mapkit" */ = { 435 | isa = XCConfigurationList; 436 | buildConfigurations = ( 437 | EE6DD9661B0B09070029B102 /* Debug */, 438 | EE6DD9671B0B09070029B102 /* Release */, 439 | ); 440 | defaultConfigurationIsVisible = 0; 441 | defaultConfigurationName = Release; 442 | }; 443 | EE6DD9681B0B09070029B102 /* Build configuration list for PBXNativeTarget "mapkitTests" */ = { 444 | isa = XCConfigurationList; 445 | buildConfigurations = ( 446 | EE6DD9691B0B09070029B102 /* Debug */, 447 | EE6DD96A1B0B09070029B102 /* Release */, 448 | ); 449 | defaultConfigurationIsVisible = 0; 450 | defaultConfigurationName = Release; 451 | }; 452 | /* End XCConfigurationList section */ 453 | }; 454 | rootObject = EE6DD93A1B0B09070029B102 /* Project object */; 455 | } 456 | --------------------------------------------------------------------------------