ios - Is there a way to know whether locationManager is active or stopped? -


in app, developing corelocation functionality module , need know whether startupdatinglocation or stopupdatinglocation have been called. know use boolean variable, wonder if there more 'globally' useful.

there no api check "running" status cllocationmanager. wrap cllocationmanager in class (or subclass it) , have "running" state on custom class.

something perhaps:

swift:

class mylocationmanager: cllocationmanager {     var running: bool      override init() {         running = false         super.init()     }      override func startupdatinglocation() {         super.startupdatinglocation()         running = true     }      override func stopupdatinglocation() {         super.stopupdatinglocation()         running = false     }  } 

objc:

@interface mylocationmanager : cllocationmanager @property (nonatomic, assign) bool running; @end  @implementation mylocationmanager - (void) startupdatinglocation {     [super startupdatinglocation];     self.running = yes; }  - (void) stopupdatinglocation {     [super stopupdatinglocation];     self.running = no; } @end 

ps: class not thread safe, idea


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)