{"id":285782,"date":"2017-05-02T09:15:14","date_gmt":"2017-05-02T05:15:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=285782"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=285782","title":{"rendered":"\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439 \u0432 iOS 24\/7"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/219\/3fd\/f73\/2193fdf73cc945d99418a1ec0266010a.png\"\/><\/p>\n<p>  \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f, \u0447\u0430\u0441\u0442\u043e \u0432\u0438\u0436\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u044d\u0442\u043e\u043c\u0443:<\/p>\n<blockquote><p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432 iOS \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440?<\/p><\/blockquote>\n<p>  \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e.<br \/>  <em>How to<\/em> \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0432\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438.  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0430 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u0430\u044f \u0438 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u043f\u044b\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u043a\u0430, \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0435\u043b\u043e-\u0442\u0440\u0435\u043a\u0435\u0440. \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u044e<\/li>\n<li>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0441\u044c<\/li>\n<li>\u041d\u0430\u0436\u0438\u043c\u0430\u044e \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0441\u044f\u0442<\/li>\n<li>\u0417\u0430\u043a\u0440\u044b\u0432\u0430\u044e<\/li>\n<li>\u041a\u0430\u0442\u0430\u044e\u0441\u044c<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u044e<\/li>\n<li>\u0412\u0438\u0436\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/li>\n<\/ol>\n<p>  <\/p>\n<p>p.s. \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 <a href=\"https:\/\/github.com\/ajjnix\/FunLocation\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c 3 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0433\u0435\u043e-\u0434\u0430\u043d\u043d\u044b\u043c\u0438.<br \/>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441\u0432\u0435\u0440\u043d\u0443\u043b \u0438\u043b\u0438 \u0436\u0435 \u0432\u043e\u0432\u0441\u0435 \u0437\u0430\u043a\u0440\u044b\u043b \u2014 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.<\/li>\n<li>\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0438.<br \/>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0438.<br \/>  \u041a\u0441\u0442\u0430\u0442\u0438, \u044d\u0442\u043e \u0441\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b.<\/li>\n<li>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  \u0420\u0430\u0431\u043e\u0442\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0443\u0436\u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"inicializaciya-menedzhera\">\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0442\u043e\u043b\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 <a href=\"https:\/\/developer.apple.com\/reference\/corelocation\/cllocationmanager\">CLLocationManager<\/a>.<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440.<\/li>\n<li>\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>import CoreLocation  final class LocationService: NSObject, CLLocationManagerDelegate {     private let locationManager = CLLocationManager()      override init() {         super.init()         locationManager.delegate = self         locationManager.startUpdatingLocation()     }      func locationManager(_ manager: CLLocationManager,                          didUpdateLocations locations: [CLLocation]) {     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0447\u0442\u043e \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"-ili-pravo-imeyu\">\u2026 \u0438\u043b\u0438 \u043f\u0440\u0430\u0432\u043e \u0438\u043c\u0435\u044e?<\/h3>\n<p>  <\/p>\n<p>iOS \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 2 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439:<\/p>\n<p>  <\/p>\n<ol>\n<li><strong>requestWhenInUseAuthorization<\/strong> \u2014 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043b\u043e\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e. <\/li>\n<li><strong>requestAlwaysAuthorization<\/strong> \u2014 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <em>CLLocationManager API<\/em>, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \/ \u0437\u0430\u043a\u0440\u044b\u0442\u043e.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439 \u0432 \u0444\u043e\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 <em>requestAlwaysAuthorization<\/em> \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 <em>requestAlwaysAuthorization<\/em> \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0444\u043e\u043d\u0435 &quot;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&quot;. \u0420\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u043c\u0438, \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u043c\u0435\u0441\u0442\u0430\u043c\u0438, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0442\u043f.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u044d\u0442\u043e \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0442\u043e \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 <em>requestWhenInUseAuthorization()<\/em> \u043b\u0438\u0431\u043e <em>requestAlwaysAuthorization()<\/em> \u043d\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0430\u043b\u0435\u0440\u0442 \u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0440\u0430\u0432.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u044f\u0441\u043d\u044f\u044e\u0449\u0438\u0439 \u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 <em>info.plist<\/em> \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u044e\u0447 <em>NSLocationAlwaysUsageDescription<\/em> \/ <em>NSLocationWhenInUseUsageDescription<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u0430\u0432, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<h2 id=\"rabotaem-v-fone\">\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 \u0444\u043e\u043d\u0435<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0433\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439 \u0432 \u0444\u043e\u043d\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c 2 \u0432\u0435\u0449\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0412\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443 <em>CLLocationManager<\/em><br \/> \n<pre><code>allowsBackgroundLocationUpdates = true<\/code><\/pre>\n<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 Background Modes (&quot;Background Modes -&gt; Location updates&quot;). \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0440\u043e\u0448\u0435\u043d exception.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412\u0441\u0435, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0444\u043e\u043d\u0435 \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0442\u043f.<\/p>\n<p>  <\/p>\n<h3 id=\"chto-to-poshlo-ne-po-planu\">\u0427\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u043f\u043e \u043f\u043b\u0430\u043d\u0443<\/h3>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0441\u0432\u0435\u0440\u043d\u0443\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0435\u043f\u043e\u0434\u0432\u0438\u0436\u043d\u043e, \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f, \u0430 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0438\u043c \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<br \/>  \u0412\u0441\u0435 \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <em>CLLocationManager<\/em> \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0430\u0443\u0437\u0443 \u0434\u043b\u044f \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438 <em><u>pausesLocationUpdatesAutomatically<\/u><\/em>. \u0418 \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442, \u043a\u0430\u043a \u043a\u0430\u0436\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<ol>\n<li>\u042f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u0447\u0430\u043b \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/li>\n<li>\u042f \u0441\u0432\u0435\u0440\u043d\u0443\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/li>\n<li>\u042f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0434\u0440\u0443\u0433\u0430 \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u0441 \u043d\u0438\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0418 \u0432 \u043a\u0430\u043a\u043e\u0439 \u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0430\u0443\u0437\u0430, \u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430 \u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0435\u0435\u0441\u044f \u0432 \u0444\u043e\u043d\u0435. \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u043f\u0430\u0443\u0437\u0430.<\/p>\n<p>  <\/p>\n<p>\u042f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435, \u043d\u043e LocationManager \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430 \u043f\u0430\u0443\u0437\u0435. \u0418 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0430\u0443\u0437\u0435, \u0434\u043e \u0442\u0435\u0445 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u044f \u0441\u0430\u043c \u043d\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0442\u0430\u0440\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0437\u0430\u0440\u044f\u0434 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e &quot;\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438&quot;. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">p.s. \u0435\u0441\u043b\u0438 \u043f\u0430\u0443\u0437\u0430 \u043d\u0443\u0436\u043d\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c <strong>\u0434\u043e<\/strong> \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u043e\u0447\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043b\u0443\u0447\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0432 \u0432 &quot;activityType&quot; \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0446\u0435\u043b\u044c, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439.<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441 \u044d\u0442\u043e \u043e\u0449\u0443\u0442\u0438\u043c\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0430\u0443\u0437\u0443 \u0434\u043b\u044f LocationManager&#8217;\u0430<\/p>\n<p>  <\/p>\n<pre><code>pausesLocationUpdatesAutomatically = false<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"ne-ubivay-menya-ivan-carevich-username\">\u041d\u0435 \u0443\u0431\u0438\u0432\u0430\u0439 \u043c\u0435\u043d\u044f, <del>\u0418\u0432\u0430\u043d-\u0446\u0430\u0440\u0435\u0432\u0438\u0447<\/del> username!<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u043d\u0435\u0435, \u044f \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u043e \u043f\u0440\u0430\u0432\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438 <em>requestAlwaysAuthorization<\/em>. \u0418 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f <em>CLLocationManager API<\/em>. \u041f\u0440\u0438\u0447\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u0432 \u0444\u043e\u043d\u0435, \u0442\u0430\u043a \u0438 \u0432 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<p>  <\/p>\n<pre><code>locationManager.startMonitoringSignificantLocationChanges() \u2014  \u043d\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f locationManager.startMonitoringVisits() \u2014 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 locationManager.startMonitoring(for: CLRegion) \u2014 \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0445\u043e\u0434 \u0438\u043b\u0438 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043c\u044b \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0443. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 <em>startMonitoringSignificantLocationChanges<\/em>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0435\u0433\u0438\u043e\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0434\u0438\u0443\u0441\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043e\u043f\u044f\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <em>CLLocationManager<\/em>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>import CoreLocation  final class LocationService: NSObject, CLLocationManagerDelegate {     private let locationManager = CLLocationManager()      override init() {         super.init()          locationManager.delegate = self         locationManager.requestAlwaysAuthorization()         locationManager.allowsBackgroundLocationUpdates = true         locationManager.pausesLocationUpdatesAutomatically = false         locationManager.startUpdatingLocation()         locationManager.startMonitoringSignificantLocationChanges()     }      func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0444\u043e\u043d\u0435, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439, \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0435\u0442\u044c\u044e \u0438 \u0442\u043f. \u0412\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u0430\u043b\u044f\u0442 \u043d\u0430\u0441 \u0441 \u0442\u0430\u043a\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0441 \u0434\u0435\u0432\u0430\u0439\u0441\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"ekonomiya-batarei\">\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0438<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f, \u0442\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e 99.99% \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0434\u0435\u0440\u043e\u043c \u0438 \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043d\u0435 \u043f\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. <\/p>\n<p>  <\/p>\n<h3 id=\"pogreshnost\">\u041f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430 \u0440\u0430\u0441\u0445\u043e\u0434 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0430\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043e\u0442 <em>CLLocationManager<\/em>.<br \/>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0442\u043e\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043c\u043e\u0436\u0435\u043c \u0441 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u043a\u043e\u043b\u043e 10 \u043c\u0435\u0442\u0440\u043e\u0432, 3 \u043a\u0438\u043b\u043e\u043c\u0435\u0442\u0440\u0430 \u0438 \u0442\u043f (<u>kCLLocationAccuracy*<\/u>).<br \/>  \u0421\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0441\u0445\u043e\u0434 \u0431\u0430\u0442\u0430\u0440\u0435\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u0432 100\u043c, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e.<br \/>  \u0411\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0438\u0437\u043a\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u0430\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0432\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0432\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e.<br \/>  p.s. \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"konfiguraciya\">\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0432 \u0431\u043e\u0440\u044c\u0431\u0435 \u0437\u0430 \u0431\u0430\u0442\u0430\u0440\u0435\u044e, \u0435\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e <u><em>distanceFilter<\/em><\/u> \u0438 <u><em>allowDeferredLocationUpdates<\/em><\/u>.<\/p>\n<p>  <\/p>\n<ul>\n<li>distanceFilter \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0442\u044c \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u044e \u0432 \u043c\u0435\u0442\u0440\u0430\u0445, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043e\u0442 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e \u0442\u043e\u0447\u043a\u0438. \u042d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f, \u043d\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044f.<\/li>\n<li>\u041e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f (allowDeferredLocationUpdates) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e, \u043b\u0438\u0431\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0438\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c\u0438.<br \/>  \u041a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0438 \u0432\u0440\u0435\u043c\u044f.<br \/>  \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 5 \u043c\u0438\u043d\u0443\u0442 \u0442\u043e\u0447\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 <strong>\u0432\u0441\u0435<\/strong> \u0440\u0430\u0437\u043e\u043c.<br \/>  \u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u043c \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0432\u043d\u043e\u0435 5 \u043c\u0438\u043d\u0443\u0442\u0430\u043c. \u0415\u0441\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u0433\u0435\u043e\u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0438 \u043d\u0430\u043c \u043e\u0442\u0434\u0430\u0442\u044c \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"rabotaem-s-dannymi-togda-kogda-eto-deystvitelno-nuzhno\">\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u044d\u0442\u043e \u0432\u0435\u043b\u043e-\u0442\u0440\u0435\u043a\u0435\u0440. \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u044b \u043e\u043d\u0438 \u043d\u0430\u043c \u0438\u043b\u0438 \u043d\u0435\u0442. \u0418\u0437-\u0437\u0430 \u043f\u0430\u0443\u0437\u044b \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u044e. <\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0435\u0437\u0434\u043a\u0438 \u0438 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043d\u0430\u0438\u0445\u0443\u0434\u0448\u0438\u043c\u0438 \u043f\u043e\u0447\u0442\u0438 \u0432 4 \u0440\u0430\u0437\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a CLLocationManager \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>func setActiveMode(_ value: Bool) {     if value {         locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters         locationManager.distanceFilter = 10         locationManager.disallowDeferredLocationUpdates()     } else {         locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers         locationManager.distanceFilter = CLLocationDistanceMax         locationManager.allowDeferredLocationUpdates(untilTraveled: CLLocationDistanceMax,                                                      timeout: CLTimeIntervalMax)     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0435\u0434\u0435\u0442 \u043d\u0430 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>CMMotionActivityManager<\/em> \u0438\u0437 <em>CoreMotion<\/em>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u0442\u0438\u043f \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>motionManager.startActivityUpdates(to: .main, withHandler: { [weak self] activity in     self?.setActiveMode(activity?.cycling ?? false) })<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 LocationService<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>import CoreLocation import CoreMotion  final class LocationService: NSObject, CLLocationManagerDelegate {     private let locationManager = CLLocationManager()     private let motionManager = CMMotionActivityManager()      override init() {         super.init()          locationManager.delegate = self         locationManager.requestAlwaysAuthorization()         locationManager.allowsBackgroundLocationUpdates = true         locationManager.pausesLocationUpdatesAutomatically = false         setActiveMode(true)         locationManager.startUpdatingLocation()         locationManager.startMonitoringSignificantLocationChanges()          motionManager.startActivityUpdates(to: .main, withHandler: { [weak self] activity in             self?.setActiveMode(activity?.cycling ?? false)         })     }      func setActiveMode(_ value: Bool) {         if value {             locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters             locationManager.distanceFilter = 10             locationManager.disallowDeferredLocationUpdates()         } else {             locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers             locationManager.distanceFilter = CLLocationDistanceMax             locationManager.allowDeferredLocationUpdates(untilTraveled: CLLocationDistanceMax,                                                          timeout: CLTimeIntervalMax)         }     }      func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0413\u0440\u0430\u0444\u0438\u043a \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f vs \u0447\u0430\u0441\u044b \u0440\u0430\u0431\u043e\u0442\u044b.<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/484\/bac\/d3f\/484bacd3f7374fc683823cc06ee4fdce.png\"\/>  <\/p>\n<p>\u0422\u0438\u043f A: \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e<br \/>  \u0422\u0438\u043f B: \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e + \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f + \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435<br \/>  \u0422\u0438\u043f C: \u0425\u0443\u0434\u0448\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e + \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f + \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435<br \/>  \u0422\u0438\u043f D: \u0411\u0435\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0435\u0449\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c? \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c, \u0435\u0441\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u0432 \u0444\u043e\u043d\u0435. \u0414\u0430\u043b\u044c\u0448\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0430\u0448\u0435\u0439 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043b\u044f iOS 10+ \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c NSMotionUsageDescription \u0432 Info.plist<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;key&gt;NSMotionUsageDescription&lt;\/key&gt;     &lt;string&gt;$(PRODUCT_NAME) motion use.&lt;\/string&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h2 id=\"proveryaem-obrabotku-geodannyh\">\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0433\u0435\u043e\u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c. \u041e\u0442\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0430 &quot;\u043f\u043e\u0435\u0437\u0434\u043a\u0443&quot; \u2014 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u0434\u0435\u044f. \u0414\u0430 \u0438 \u043f\u0440\u043e \u0434\u0435\u0431\u0430\u0433\u0438\u043d\u0433 \u0432 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u044b\u0442\u044c. <\/p>\n<p>  <\/p>\n<p>\u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, Apple \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/GPS_Exchange_Format\">GPX<\/a> \u0444\u0430\u0439\u043b\u044b (\u0438 \u043d\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0432\u0430\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0434\u0430\u043d\u043d\u044b\u043c \u0441\u043b\u0443\u0447\u0430\u0435).<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 gpx \u0444\u0430\u0439\u043b \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot;?&gt; &lt;gpx version=&quot;1.1&quot; creator=&quot;Xcode&quot;&gt;     &lt;wpt lat=&quot;54.91148&quot; lon=&quot;83.07381&quot;\/&gt;     &lt;wpt lat=&quot;54.90792&quot; lon=&quot;83.07243&quot;\/&gt; &lt;\/gpx&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0441\u0445\u0435\u043c\u044b \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0430\u0448 GPX \u0444\u0430\u0439\u043b.<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ed8\/0ab\/40d\/ed80ab40d6814a5092bd33c5c7823434.png\"\/><\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u043e\u0439.<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/32c\/29e\/532\/32c29e5325764f45b94cbfdf62ea5df1.png\"\/><\/div>\n<\/div>\n<p>  <\/p>\n<h2 id=\"vmesto-zaklyucheniya\">\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043c\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 &quot;\u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c&quot; \u0432 \u0444\u043e\u043d\u0435, \u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e &quot;\u0443\u0431\u0438\u0442\u044c&quot;.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u044f \u0443\u0448\u043b\u0430 \u0432 \u043f\u0430\u0443\u0437\u0443, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0444\u043e\u043d\u0435, \u0442\u043e \u0441\u043d\u044f\u0442\u044c \u0441 \u043f\u0430\u0443\u0437\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u0440\u0435\u0433\u0438\u043e\u043d\u044b \u0438 \u0442\u043f. \u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 &quot;\u0440\u0430\u0437\u0432\u043e\u0440\u043e\u0442\u0430&quot; \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li>\u0413\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c\u044e. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c 10 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0434\u0435\u0432\u0430\u0439\u0441\u0435, \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 &quot;\u043d\u043e\u0432\u043e\u0439&quot; \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043a\u0430\u0440\u0442\u044b. <\/li>\n<li>\u041f\u0440\u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0432\u0430\u0439\u0441 \u043c\u043e\u0436\u0435\u0442 &quot;\u0437\u0430\u043b\u0438\u043f\u043d\u0443\u0442\u044c&quot; \u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0442\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e. \u041f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430.<\/li>\n<li>\u041f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u043e, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 &quot;\u0441\u0442\u0430\u0442\u0443\u044e \u0442\u043e\u0447\u043a\u0443&quot;. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e\u0442\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c <em>ts<\/em>.<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 <em>CLLocationManager<\/em> \u0438 \u043f\u0430\u0440\u0441\u0438\u0442\u044c <em>GPX<\/em> \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<li>GPX \u0444\u0430\u0439\u043b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u0447\u043a\u0430\u0445.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>p.s. \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 <a href=\"https:\/\/github.com\/ajjnix\/FunLocation\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/275769\/\"> https:\/\/habrahabr.ru\/post\/275769\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/219\/3fd\/f73\/2193fdf73cc945d99418a1ec0266010a.png\"\/><\/p>\n<p>  \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f, \u0447\u0430\u0441\u0442\u043e \u0432\u0438\u0436\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u044d\u0442\u043e\u043c\u0443:<\/p>\n<blockquote><p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432 iOS \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440?<\/p><\/blockquote>\n<p>  \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e.<br \/>  <em>How to<\/em> \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0432\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438.  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0430 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u0430\u044f \u0438 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u043f\u044b\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u043a\u0430, \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0435\u043b\u043e-\u0442\u0440\u0435\u043a\u0435\u0440. \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u044e<\/li>\n<li>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0441\u044c<\/li>\n<li>\u041d\u0430\u0436\u0438\u043c\u0430\u044e \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0441\u044f\u0442<\/li>\n<li>\u0417\u0430\u043a\u0440\u044b\u0432\u0430\u044e<\/li>\n<li>\u041a\u0430\u0442\u0430\u044e\u0441\u044c<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u044e<\/li>\n<li>\u0412\u0438\u0436\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/li>\n<\/ol>\n<p>  <\/p>\n<p>p.s. \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 <a href=\"https:\/\/github.com\/ajjnix\/FunLocation\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-285782","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=285782"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285782\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}