NWPathMonitor's pathUpdateHandler block is getting called on app background to foreground transition
NWPathMonitor's pathUpdateHandler is getting called when the app is transitioned from background to foreground with a delay of >30secs in the background even when there is no change in the Network. This isn't expected.
Also when network changes 'pathUpdateHandler' block gets invoked multiple times for the same interface type with same status (e.g., when I change from No WiFi -> WiFi, pathUpdateHandler is getting called 3 to 4 times with status satisfied and interface type wifi)
Is this expected behaviour? Or is there a workaround for this kind of behaviour? I tested it on iPhone6S with iOS 13.7 and iPad with iOS 14.0 Here is my code snippet
(void) startMonitor {
self.pathMonitor = nw_path_monitor_create();
nw_path_monitor_set_update_handler(self.pathMonitor, ^(nw_path_t	_Nonnull path) {
		
		DDLogVerbose(@"Network path changed %d", nw_path_get_status(path));
		if (nw_path_uses_interface_type(path, nw_interface_type_wifi))	{
				DDLogVerbose(@"Network path user interface type WiFi");
		} else if (nw_path_uses_interface_type(path, nw_interface_type_cellular))	{
				DDLogVerbose(@"Network path user interface type Cellular");
		} else if (nw_path_uses_interface_type(path, nw_interface_type_wired))	{
				DDLogVerbose(@"Network path user interface type Wired");
		} else if (nw_path_uses_interface_type(path, nw_interface_type_loopback))	{
				DDLogVerbose(@"Network path user interface type Loopback");
		} else if (nw_path_uses_interface_type(path, nw_interface_type_other))	{
				DDLogVerbose(@"Network path user interface type Other");
		}
});
nw_path_monitor_start(self.pathMonitor);
}
The output is same even if I create the nwpathmonitor with a particular interface type