BlueSocket
BlueSocket copied to clipboard
Socket listen failed on iOS 14.0.1
Hello everyone,
with update to iOS 14.0.1 (not tried on 14.0) I'm not able anymore to start Socket with listen
method.
Here is my code:
var listenData = Data.init()
let message = try self.socket?.listen(forMessage: &listenData, on: self.destinationPort)
let hexString = listenData.hexadecimal
// If message is shorter than the default one (48 chars), ignore it
guard hexString.count >= 48 else {
// Ignore message
return
}
self.address = message?.address ?? nil
self.sourcePort = Socket.hostnameAndPort(from: self.address!)?.port
I'm not able to retrieve address and source port. I'm able to let it work just re-run the app from Xcode otherwise it doesn't work. It works perfectly on iOS 14.2 Someone noticed this problem?
Thank you in advance for your help!
I'm having the same issue. Did someone know if there are solutions or workarounds for this?
Hi there, got the same problem but it's working in debug mode and not through TestFlight (in release mode)... Since iOS 14 an entitlement is required to listen UDP broadcasting : https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_multicast I just fill and send form and waiting for apple response. I'll let you know if it's working.
Hi @fb64 i already asked for the entitlement but Apple said we don't need it. I'm also following this thread on Apple forum https://developer.apple.com/forums/thread/662082
Hi @fb64, did you receive any reply from Apple?
This is the reply I received:
Thank you for your interest in Multicast Networking. It sounds like you’re using WebSockets to make a unicast UDP connection to your devices. If that’s the case, you shouldn’t need the entitlement, just add the usage description so your users know why you use their local network and you should be all set. See How to use multicast networking in your app for more details, and if you have questions or issues, please use the “Network” tag on the Apple Developer Forums.
Hi @igorsquadra, FYI my request was approved :
Your request to use Multicast Networking was approved. You can now add the Multicast Networking entitlement with your Provisioning Profile. Instructions for using the entitlement are available and, for more information on using multicast, please read How to use multicast networking in your app. If you have questions or issues, please use the “Network” tag on the Apple Developer Forums.
I'll try that in coming days...
Hi @fb64, thanks for your update. I just try with iOS 14.2 beta and it works well, so my problem is related to the current iOS version
Hi there, for information it's working well on iOS 14 in release mode.
After my request for entitlement was approved, I add the new network Capability to my App Identifier :
I just had to add few lines to my existing code to trigger the Apple permission Alert and everything working well.
I think the issue can be closed.