Giter Site home page Giter Site logo

liuyunxinok / lyxlocationmanager Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 47 KB

在我们使用app的过程中,很普遍的见到请求我们所在的位置信息,用来匹配附近,同城的展示信息。为以后重复造轮子,方便使用,抽出来封装了LYXLocationManager. 里面的api可以方便的获取用户的详细位置信息,独立的county, province, city, district等信息获取。

Objective-C 100.00%

lyxlocationmanager's Introduction

LYXLocationManager

在我们使用app的过程中,很普遍的见到请求我们所在的位置信息,用来匹配附近,同城的展示信息。为以后重复造轮子,方便使用,抽出来封装了LYXLocationManager. 里面的api可以方便的获取用户的详细位置信息,独立的county, province, city, district等信息获取。

集成方式:

1.由于比较轻量,下载下来,当做一个工具类,导入项目中。

2.在需要使用的vc中导入下面的头文件

  #import "LYXLocationManager.h"

3.使用下的方法获取用户位置信息

  //请求授权
  [LYXLocationManager lyx_requestWhenInUseAuthorization];
  [LYXLocationManager lyx_requestAlwaysAuthorization];
  //请求用户位置信息
  [LYXLocationManager lyx_requestLocationWith:^(NSString *locationDetail, CLPlacemark *placemark, NSError *error) {
        if (error == nil) {
            self.locationLabel.text = locationDetail ?: @"未获取到位置信息";
        }else{
            self.locationLabel.text = @"获取位置错误";
        }
  }];

lyxlocationmanager's People

Contributors

liuyunxinok avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.