You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not entirely sure why, but when referencing a ping instance inside observer logic, when entering background via NotificationCenter, it gets triggered twice.
Error triggering example:
letpinger:SwiftyPingletconfig=PingConfiguration(interval:1, with:5)
if IPv4Address(address)!=nil{
pinger =try.init(ipv4Address: address, config: config, queue:.global())}else{
pinger =try.init(host: address, configuration: config, queue:.global())}
pinger.targetCount =3
pinger.observer ={ _ in
if false {
pinger.haltPinging()}}
pinger.finished ={(response)inprint("Foo")}
Not triggering example:
letpinger:SwiftyPingletconfig=PingConfiguration(interval:1, with:5)
if IPv4Address(address)!=nil{
pinger =try.init(ipv4Address: address, config: config, queue:.global())}else{
pinger =try.init(host: address, configuration: config, queue:.global())}
pinger.targetCount =3
pinger.observer ={ _ inprint("Yeah, no idea why")}
pinger.finished ={(response)inprint("Foo")}
From what I'm seeing in the code private func addAppStateNotifications() { does have a #if os(iOS) so I'll open a PR adding to that with a && !targetEnvironment(macCatalyst) which should do the trick as I'm assuming there's no need to halt pinging when moving to background on Mac, but it doesn't quite explain why the heck capturing a reference to the ping instance even when never using it makes it trigger twice.
The text was updated successfully, but these errors were encountered:
Not entirely sure why, but when referencing a ping instance inside observer logic, when entering background via NotificationCenter, it gets triggered twice.
Error triggering example:
Not triggering example:
From what I'm seeing in the code
private func addAppStateNotifications() {
does have a#if os(iOS)
so I'll open a PR adding to that with a&& !targetEnvironment(macCatalyst)
which should do the trick as I'm assuming there's no need to halt pinging when moving to background on Mac, but it doesn't quite explain why the heck capturing a reference to the ping instance even when never using it makes it trigger twice.The text was updated successfully, but these errors were encountered: