Latest 0.2.0
Homepage https://github.com/liuqing520it/GetPositionPods
License MIT
Platforms ios 8.0
Dependencies AMap3DMap, AMapSearch
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

image

Requirements

  • info.plist must add some keys : "Privacy – Location When In Use Usage Description" and "Privacy – Location Always and When In Use Usage Description"

Installation

GetPositionPods is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'GetPositionPods'

Usage

Import header and follow deleagate

#import <LQGetLocationInfoVC.h>
@interface ViewController ()<LQGetLocationInfoVCDelegate>

Implement the proxy method

/**
present选择地址的控制器
*/
- (void)presentVC{
    ///这里的ApiKey 是高德开放平台申请的,需要绑定对应的bundle id;具体申请流程请参考'高德开放平台'
    LQGetLocationInfoVC *locationVC = [[LQGetLocationInfoVC alloc]initWithApiKey:@"491fb90b01e62xxx9cf80ec44a14bd03d"];
    locationVC.delegate = self;
    [self presentViewController:[[UINavigationController alloc]initWithRootViewController:locationVC] animated:YES completion:nil];
}

/**
获取地理位置信息
@param latitude 经度
@param longitude 纬度
@param province 省
@param city 市
@param district 行政区
@param position 详细位置信息
*/
- (void)getLocationLatitude:(double)latitude
                  longitude:(double)longitude
                   province:(NSString *)province
                       city:(NSString *)city
                   district:(NSString *)district
                   position:(NSString *)position{
    //这里只是将结果alert出来,方便验证
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"位置信息" message:[NSString stringWithFormat:@"经度:%f;n纬度:%f;n%@-%@-%@-%@",latitude,longitude,province,city,district,position] preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
    [alert dismissViewControllerAnimated:YES completion:nil];
    }]];
    [self presentViewController:alert animated:YES completion:nil];
}

Author

liuqing, [email protected]

License

GetPositionPods is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "GetPositionPods",
    "version": "0.2.0",
    "summary": "GetPositionPods.",
    "description": "TODO: GetPositionPods.u83b7u53d6u5f53u524du4f4du7f6eu4fe1u606f",
    "homepage": "https://github.com/liuqing520it/GetPositionPods",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "liuqing520it": "[email protected]"
    },
    "source": {
        "git": "https://github.com/liuqing520it/GetPositionPods.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "GetPositionPods/Classes/**/*",
    "resource_bundles": {
        "GetPositionPods": [
            "GetPositionPods/Assets/*.png"
        ]
    },
    "dependencies": {
        "AMap3DMap": [],
        "AMapSearch": []
    }
}

Pin It on Pinterest

Share This