ios - how to make data to delete in 24hrs in firebase by swift3 -


var ref = database.database().reference().child("essages") var childref = database.database().reference().child("essages").childbyautoid()  @ibaction func sendbtn(_ sender: any) {         posting()     }      func posting(){          let values = ["message" : captiontextview.text] [string : any]         childref.updatechildvalues(values) { (error, ref) in             if error != nil {                 print("error")             }else {  let = timer.scheduledtimer(timeinterval: 90000, target: self, selector: #selector(self.ontick), userinfo: nil, repeats: false)             }         }     }     func ontick(){         childref.removevalue()     } 

if app open timer working , deleting data. if close app timer not working , data not deleted. please me in sorting problem. i'm trying feature snapchat (deleting in 24hrs).

you try perhaps new firebase cloud function feature, think best , easiest option. in beta until couple of weeks ago it's functional.

there similar question on thread here. can find nice tutorial on firebase blog. in general, following coding practices, shouldn't triggering client. data cleanup, , in other form of updates should done backend itself.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -