startMonitoringSignificantLocationChanges not working in swift

后端 未结 4 1303
我寻月下人不归
我寻月下人不归 2021-01-02 10:31

I\'d added CLLocationManager in my app using Swift in the AppDelegate file.

In the Appdelegate.swift file,

import CoreLocation
@UIApplicationMain
cla         


        
相关标签:
4条回答
  • 2021-01-02 11:03

    Note: Apps can expect a notification as soon as the device moves 500 meters or more from its previous notification. It should not expect notifications more frequently than once every five minutes. If the device is able to retrieve data from the network, the location manager is much more likely to deliver notifications in a timely manner. startMonitoringSignificantLocationChanges()

    0 讨论(0)
  • 2021-01-02 11:04

    In your simulator, goto Debug->Location->Custom and change location, then test it.

    0 讨论(0)
  • 2021-01-02 11:05

    In your simulator, select Features -> Location -> Freeway Drive

    Wait a bit for startMonitoringSignificantLocationChanges to trigger didUpdateLocations.

    0 讨论(0)
  • 2021-01-02 11:07

    It's working, but it's really hard to trigger significant location changes - it usually happens when the device is changing cell towers - I don't think it's possible to do with the simulator.

    You'd probably have to get on a bike/car and travel AT LEAST a few kilometres.

    There's a trick you can use though, that will trigger significant location change:

    Switch Airplaine mode in your iPhone on and off with a few second intervals repeatedly, it should trick the device into thinking that it changed cell towers and trigger the significant location change.

    0 讨论(0)
提交回复
热议问题