# location **Repository Path**: liuhui.com/location ## Basic Information - **Project Name**: location - **Description**: 使用苹果自带框架进行定位,用block封装 - **Primary Language**: Objective-C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2016-08-02 - **Last Updated**: 2021-09-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #location iOS交流群:479192251 欢迎各位大牛加群讨论! 1 -导入头文件“LH_CLLocationManager.h” 2 -实例化定位管理者的对象 LH_CLLocationManager* manger=[LH_CLLocationManager shareLocation]; 3 -如果定位成功后,调用block 例如 [manger lh_getCurrentCity:^(NSString *cityString) { NSLog(@"当前城市:%@",cityString); }]; [manger lh_getCurrentCountry:^(NSString *countryString) { NSLog(@"当前国家:%@",countryString); }]; [manger lh_getCurrentProvince:^(NSString *provinceString) { NSLog(@"当前省份:%@",provinceString); }]; [manger lh_getCurrentThoroughfare:^(NSString *thoroughfareString) { NSLog(@"当前街道:%@",thoroughfareString); }]; [manger lh_getCurrentDetailAddress:^(NSString *detailAddressString) { NSLog(@"当前详细地址:%@",detailAddressString); }]; [manger lh_getCurrentPostalCode:^(NSString *postalCodeString) { NSLog(@"当前邮政编码:%@",postalCodeString); }]; [manger lh_getCurrentLocationCoordinate:^(CLLocationCoordinate2D locationCorrrdinate) { NSLog(@"当前位置经纬度(%lf,%lf)",locationCorrrdinate.latitude,locationCorrrdinate.longitude); }]; [manger lh_getCurrentLocationCoordinate:^(CLLocationCoordinate2D locationCorrrdinate) { NSLog(@"======当前位置经纬度(%lf,%lf)",locationCorrrdinate.latitude,locationCorrrdinate.longitude); } withAddress:^(NSString *detailAddressString) { NSLog(@"------当前详细地址:%@",detailAddressString); 4 -注意 ![](/Users/apple/Desktop/屏幕快照 2016-08-02 下午2.01.47.png)