Home  >  Q&A  >  body text

ios - 需求:【室内定位】在【公司前台】让客户摇一摇手机,签到。

1.限定了范围大概前台方圆50m范围内(公司在71楼,260m)
2.签到不需要让客户知道,所以只有摇一摇事件,没有界面。
3.公司前台的坐标能够拿到,我写定了。
4.我的做法是 :用自带的CoreLocation框架,拿到客户定位经纬度坐标,得到与前台的经纬度之间的距离(单位:米),距离小于50,则可以进行签到。

 func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
             
        /** 获取到最新的坐标 */
       let currentLocation : CLLocation = locations.last!
       
       let currentLongitude = currentLocation.coordinate.longitude
       let currentLatitude  = currentLocation.coordinate.latitude
        
        
        /** 客户坐标和目标坐标之间的距离 */
        let distance : CLLocationDistance = currentLocation.distanceFromLocation(SQLocation)
        
        finalDistance = distance
        
        distanceLabel.text = String(format: "距离SQ公司:%.2f 米",finalDistance)
    }

现在的问题是 : 用移动网络定位,效果很差劲,精确度比wifi下定位精确度低,信号不好剩下1格的时候,更新定位距离设为1m,也很久不更新定位。

有没有精确度高点的方案,难度小点,或者可以进行改进的地方。
需要使用高德地图吗,我只需要用户的定位,不做别的,自带的定位CoreLocation,难道满足不了?
PHP中文网PHP中文网2716 days ago344

reply all(5)I'll reply

  • 阿神

    阿神2017-04-18 09:16:04

    For the questioner’s solution, you can choose a third-party positioning solution, such as Amap or Baidu. You can refer to the relevant API, Baidu Positioning iOS SDK

    reply
    0
  • ringa_lee

    ringa_lee2017-04-18 09:16:04

    This probably won’t work, positioning is very tricky, sometimes it’s hundreds of meters away from the actual coordinates, so we have to change our thinking, or expand the 50m limit

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 09:16:04

    Bluetooth and WLAN are now commonly used for indoor positioning on the market

    Require customers to turn on Bluetooth/WLAN to obtain location information using CoreLocation of iOS
    (You need to wait for iOS to upload the corresponding WLAN, Bluetooth data and location information back to the server)

    Your needs can be realized by comparing the mac addresses of nearby WLAN and Bluetooth devices

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 09:16:04

    Use a BLE development board or directly purchase a small ibeacon device and put it at the front desk. It can be accurate to centimeter level or up to 10 meters+
    Android/iOS can directly perform short-distance ranging
    iOS and Android have corresponding SDKs
    In addition, you can also use WeChat shake method and integrate according to WeChat protocol

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 09:16:04

    Looked at the poster’s posting list
    I suggest the poster make good use of Google
    If not, Baidu
    Just search for this kind of question and you’ll find a lot of them

    reply
    0
  • Cancelreply