-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add retry logic for Wi-Fi LAN advertising to avoid issues on iOS 14.8.1 #2061
Comments
@bourdakos1 forgot to tell that the |
It looks like it failed to start listening for incoming connections, but the system didn't return any an explicit errors. My best guess is that the listener transitioned to the However, I don't have an iOS 14.8.1 device to verify. Do you mind trying to add some logs here: nearby/internal/platform/implementation/apple/Mediums/WiFiLAN/GNCWiFiLANServerSocket.m Line 207 in 5589166
I can also push an update with more logs if thats easier, but that might take some time to get reviewed/submitted |
Thanks for verifying! I need to look into how to properly handle this case |
I made this workaround private func startAdvertise(nearbyMessage: NearbyMessage, retryCount: Int) {
print("[NearbyManager] Retrying startAdvertise: \(retryCount)")
guard
let nearbyMessageData = nearbyMessage.dataValue,
retryCount > 0
else {
return
}
advertiser.startAdvertising(
using: nearbyMessageData,
completionHandler: { error in
guard let error = error else {
print("[NearbyManager] Success on startAdvertising")
return
}
print("[NearbyManager] Failed to advertise: \(error.localizedDescription)")
let timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { [weak self] timer in
self?.startAdvertise(nearbyMessage: nearbyMessage, retryCount: retryCount-1)
}
timer.fire()
}
)
} Eventually it will work:
|
Awesome! So it is just a matter of retrying. I'll update this issue to reflect the need for adding internal retry logic for Wi-Fi LAN |
Thanks for answering so fast! I will keep subscribed on this issue so we can update the lib on our end :) |
I'm currently using the latest version of the Nearby SPM.
The exact same code runs ok, and I'm able to
startAdvertising
on iOS 16.6 but on iOS 14.8.1 it fails to start.These are the logs that I have
The text was updated successfully, but these errors were encountered: