mapkit - Swift: How can I make less didupdatelocation calls -
i've come code prints address , postalcode of location. done in didupdatelocation function.
the problem occur, every second address get's updated "didupdatelocation" function. because battery ineffecient, looking ways use interval couldn't find ways (also not on google en stackoverflow) on how this.
can give me tips how can in swift?
the answers of rajeshkumar , basir doesn't change battery power, delegate method still called same number of times per minute.
if want have more efficient behavior, try change values of distancefilter, desiredaccuracy, , activitytype (you can find need here)
manager.distancefilter = 50 // distance changes want informed (in meters) manager.desiredaccuracy = 10 // biggest approximation tolerate (in meters) manager.activitytype = .automotivenavigation // .automotivenavigation stop updates when device not moving
also if need location of user when changes significantly, can monitor significantlocationchanges, can work when app killed.
Comments
Post a Comment