ios - I am facing two errors in this code help me to solve it -


code:

var bgtask: backgroundtaskmanager! = uiapplication.sharedapplication().beginbackgroundtaskwithexpirationhandler({() -> void in print("ending background task") uiapplication.sharedapplication().endbackgroundtask(self.bgtask) self.bgtask = uibackgroundtaskinvalid }) self.timer = nstimer.scheduledtimerwithtimeinterval(             60,              target: self.locationmanager,              selector: #selector(self.startupdatinglocation),              userinfo: nil, repeats: true) 

enter image description here

you using self.bgtask,self.timer,self.locationmanager etc have declare globally like,

var bgtask: uibackgroundtaskidentifier! = uibackgroundtaskidentifier()  var timer: nstimer! = nstimer()  var locationmanager : cllocationmanager!  = cllocationmanager() 

second thing var bgtask: backgroundtaskmanager! wrong, should var bgtask: uibackgroundtaskidentifier!


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -