Need help setting up Time Sensitive push notifications iOS swift -
i have set push notifications parse , can send 1 parse , receive on device. now, in app have expiring objects. send users notification that object expiring in x amount of days. have written following code in appdelegate.swift , didfinishlaunchingwithoptions method:
let today = nsdate() let sevendays:double = (7*60*60*24) let fourteendays:double = (14*60*60*24) let tomorrow:double = (2*60*60*24) if today.timeintervalsincedate(expirationdate) == sevendays { print("expiring in 7 days") let channels = [newvacstring] let push = pfpush() let data = ["alert" : "uh oh! \(dogname)'s \(newvacstring) dogument expiring in 7 days!", "badge" : "increment", "vaccine" : newvacstring, "dogname" : dogname, "dogobject" : dogobject] push.setchannels(channels) push.setdata(data) push.sendpushinbackground() }
after attempting debug this, doesn't run code on if statements (i've tried shorter increments). should placing code in method somewhere else? appreciated!
Comments
Post a Comment