arcam / CocoaUPnP

CocoaUPnP is a logical progression of upnpx; designed to be easy, modern and block-based.
MIT License
85 stars 40 forks source link

Devices search failed on iOS 14 and deployment target iOS 12 or newer #62

Open petrutms opened 3 years ago

petrutms commented 3 years ago

If I set deployment target to iOS 12, app will fail to discover devices. This happens in the sample app also. I couldn't find a fix yet. Any help will be appreciated.

squarefrog commented 3 years ago

I’ve run into this too when I bumped.

What happens is the first message you send after connecting the multicast group always returns a “no route to host” error.

If you build with Xcode 11, there’s no problem. If you build with Xcode 12, with a minimum deployment target of iOS 11, there’s no error. So there’s only an error when building with Xcode 12, targeting iOS 12 and above, and only on iOS 14 devices.

I pushed some code to the develop branch, that’s worth a look at. I’m not convinced it solves the issue, but you’re welcome to try!

petrutms commented 3 years ago

I can only target iOS 12 or better, due to app features. The example app now detects almost all devices, except webos LG. The services for LG sometimes appear much later, maybe after 10-20 seconds, but many times LG is not detected at all, unless I turn off then on the TV.

This error always in console: Could not start browsing for services: Error Domain=NSPOSIXErrorDomain Code=65 "No route to host" UserInfo={NSLocalizedDescription=No route to host, NSLocalizedFailureReason=Error in send() function.}

Thanks. Let me know how I can help to fix this issue! P.S. do you think the new multicast entitlement on iOS 14 is need for this to work?

squarefrog commented 3 years ago

That indicates the search isn’t getting sent, and the LG device is merely announcing its presence.

There are others having this issue: https://developer.apple.com/forums/thread/661606?login=true&page=1#650998022

I had hoped iOS 14.3 would fix it but I haven’t tested it under that yet.

Digging into the CocoaAsyncSocket dependency, it seems they are destroying the socket when that error is returned, whereas we need to keep it open and just ignore the first faulty error. I haven’t found a solution yet, but that’s where I’d direct you if you’re under time constraints.

petrutms commented 3 years ago

I am testing on iOS 14.3, no change there unfortunately... Thanks for the help, will keep looking

petrutms commented 3 years ago

Tested one of my older projects that use connect sdk, the discovery issue isn't there in the same build conditions. So something broken in CocoaAsync maybe... For the moment I asked apple for multicast entitlement...

squarefrog commented 3 years ago

Have you tried building from Xcode 11?

petrutms commented 3 years ago

I just did. There is the same issue with LG, not detected or detected very slowly. Other brands work fine. Also multicast doesn't help.

edit: it happens only on iOS 14

squarefrog commented 3 years ago

Did you get your multicast entitlement approved by Apple, and did it solve your issue?

petrutms commented 3 years ago

Didn’t solve the problem.I changed dlna library to connect SDK, that solved my problem.

Trimis din Yahoo Mail pentru iPhone

La marți, ianuarie 26, 2021, 13:45, Paul Williamson notifications@github.com a scris:

Did you get your multicast entitlement approved by Apple, and did it solve your issue?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

squarefrog commented 3 years ago

OK thanks for the update!