In didFinishLaunchingWithOptions
I do:
AFNetworkReachabilityManager.shared().startMonitoring()
NotificationCenter.default.addObserver(self, selector: #selector(networkDidChangeStatus), name: NSNotification.Name.AFNetworkingReachabilityDidChange, object: nil)
my function for selector is following:
func networkDidChangeStatus() {
//UPLOAD CHANGES TO ICLOUD DATABASE
}
All I need to do is to upload changes immediately after device is connected to the network even when the app is not opened.
It works pretty well when app is in foreground mode, but do not know what to do when app is in the background mode. Is it possible at all?
I did turn on BACKGROUND MODES in Capabilities tab.