swift3 - Triggering local notification when certain conditions are met in iOS 10 (Swift 3) -


i developing ios 10 using swift 3. want make app fetch data remote server silently in background once in while , send push notification user when new data available. know remote notification perhaps better way handle this, there way of achieving locally? know can push notifications @ time or when user has entered locations, there way in can trigger notifications programmatically?

when data arrive can send "uilocalnotification" notification. (a push notifications involves servers, certificates... , on..)

i suggest:

a) using performfetchwithcompletionhandler

as per adc:

"when opportunity arises, system wakes or launches app background , calls app delegate’s application:performfetchwithcompletionhandler: method. use method check new content , initiate download operation if content available."

b) in performfetchwithcompletionhandler trigger download. pass down completionhandler code use nsurl session.

c) when download done, trigger local notifcation, , execute completionhandler ios has sent in "performfetchwithcompletionhandler'

as usual note have strict time constraints..

another way (maybe simpler..) using backgroundsessionconfiguration/downloadtask.

in call send local notification.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -