I was asked to describe my setup
#16
Sadly I have no device with iOS 15 or older. I can use the simulator on my MacBook for this, but network wise this does not behave same.

On the code base: First, I would confirm the assumption where in the App code this fails. Assumption based on tag "1.11.1-b5":
- The error is thrown from tcpJSONRPC.m, line 230.
- The function failing is in DSJSONRPC.m, line 105
- The call which finally fails I suspect is in DSJSONRPC.m, line 168. Calling the iOS framework function NSURLConnection:initWithRequest:delegate.

Edit:
Inspired by your comment on the hotspot I now enabled the hotspot on my Windows notebook which runs the Linux guest with my Kodi server test system, and then connected the iPhone to it. I also configured to notebook with and without internet access (WiFi connection to my router enabled/disabled). "Find Kodi" does not find the server anymore, but connecting to the known IP and loading content still works. I am running out of options.
Reply
#17
Thank you for the answers. I might take a look at that, if I find the time.

Quote:"Find Kodi" does not find the server anymore, but connecting to the known IP and loading content still works.

Hmm, well, I'm assuming "Find Kodi" is using zeroconf, which in turn is using multicast, which granted is also what mDNS uses (iirc), but did you explicitly try connecting to the machine's .local address? Connecting to the resolved IP address is expected to work, after all.

Well, I'll revive this if I come across additional details.
Reply
#18
I built and ran it:
Quote:- The error is thrown from tcpJSONRPC.m, line 230.
Yes
Quote:- The function failing is in DSJSONRPC.m, line 105
Yes
Quote:- The call which finally fails I suspect is in DSJSONRPC.m, line 168. Calling the iOS framework function NSURLConnection:initWithRequest:delegate.
Probably.

I sprinkled some breakpoints on a few functions and places you mentioned, with error.localizedDescription printed where appropriate — the long integers are the `aId`s:

lldb:

-checkServer
-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 1
640268820

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 2
752361287

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 3
1266404273

-connection:didFailWithError: count: 1
640268820

The Internet connection appears to be offline.

tcpJSONRPC.m.230 count: 1
The Internet connection appears to be offline.

-connection:didFailWithError: count: 2
752361287

The Internet connection appears to be offline.

-connection:didFailWithError: count: 3
1266404273

The Internet connection appears to be offline.

-checkServer
-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 4
3624677553

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 5
1696145596

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 6
3212533191

-connection:didFailWithError: count: 4
3624677553

The Internet connection appears to be offline.

tcpJSONRPC.m.230 count: 2
The Internet connection appears to be offline.

-connection:didFailWithError: count: 5
1696145596

The Internet connection appears to be offline.

-connection:didFailWithError: count: 6
3212533191

The Internet connection appears to be offline.

-checkServer
-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 7
3618296799

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 8
3028225577

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 9
198065855

-connection:didFailWithError: count: 7
3618296799

The Internet connection appears to be offline.

tcpJSONRPC.m.230 count: 3
The Internet connection appears to be offline.

-connection:didFailWithError: count: 8
3028225577

The Internet connection appears to be offline.

-connection:didFailWithError: count: 9
198065855

The Internet connection appears to be offline.

-checkServer
-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 10
2416672275

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 11
1852186839

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 12
2621809186

-connection:didFailWithError: count: 10
2416672275

The Internet connection appears to be offline.

tcpJSONRPC.m.230 count: 4
The Internet connection appears to be offline.

-connection:didFailWithError: count: 11
1852186839

The Internet connection appears to be offline.

-checkServer
-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 13
139870121

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 14
3546530106

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 15
2229083998

-connection:didFailWithError: count: 12
139870121

The Internet connection appears to be offline.

tcpJSONRPC.m.230 count: 5
The Internet connection appears to be offline.

-connection:didFailWithError: count: 13
3546530106

The Internet connection appears to be offline.

-checkServer
-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 16
351479385

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 17
487159985

-callMethod:withParameters:withTimeout:onCompletion:
DSJSONRPC.m.168 count: 18
1439784338

-connection:didFailWithError: count: 14
351479385

The Internet connection appears to be offline.

tcpJSONRPC.m.230 count: 6
The Internet connection appears to be offline.

-connection:didFailWithError: count: 15
487159985

The Internet connection appears to be offline.

-connection:didFailWithError: count: 16
1439784338

The Internet connection appears to be offline.

It was a pain to format debugger output nicely so I gave up.

Seems every error is the same, but only every third is on line 230. Three requests always seem to fire at the same time.

I also notice that NSURLConnection is deprecated since iOS 9. Would it be far-fetched to think it's unaware of the existence of per-app cellular access settings, thereby assuming it should always go for cellular in the absence of a default wifi route, as long as cellular isn't globally disabled? Just a guess.

The deployment target seems to be for iOS 9. I don't know about the strategy for the app with regards to deployment target or Swift, but what about for NSURLSession?
Reply
#19
Thanks, the 3 calls inside checkServer are expected, the debug output in the App should only be triggered by line 230. But each call finally comes back with the same error.

You're correct on the deprecation notice. The App version 12 (next after next) is planned to migrate to Xcode14 to handle some problems with layout for iPhone 14 Pro (see GitHub#727). This also requires to set the minimum deployment target to iOS 11 -- as this is mandated by ApStore. A while back I already worked on migrating to NSURLSession, but could not finish and finally deleted the changes.

Maybe worth a try: About two years back NSURLConnection was already replaced by NSURLSession at another location in the App. This is triggered when using "Find Kodi". Maybe you can locally roll this back an also check for any error on this? The commit to roll back is this one: https://github.com/xbmc/Official-Kodi-Re...e7fd57057f
Reply
#20
There's also the question in my message just before my last one, about whether you tried .local or just an IP address?

Ok, I've looked at that commit now but I don't understand exactly how those three lines will affect what we've been looking at? Isn't that the VC for adding a host? And aren't those lines only for zeroconf discovery, as opposed to actually connecting to a saved host?
Reply
#21
I was only testing it with an IP, not with a host name.

As far as I understood (not my code) the 3 lines of code will ping the server after the zeroconf discovery to identify the MAC address for the wake-on-LAN feature. Does this show an error for you in the debugger? If not, does it show an error after rollback to NSURLConnection? If so, it could be a sign that NSURLConnection is the problem.

Edit:
Just prepared the rollback as there was another change which was required: https://github.com/wutschel/Official-Kod...tree/nsurl
Now it will be interesting if connection:didFailWithError: also fails with the error message.

Edit 2:
Started to look into the migration to NSURLSession again. Testing the change mentioned above will help understanding if this might be the solution.
Reply
#22
I could now do a really hacky first implementation to check if NSURLSession solves the problem. Can you give this a try: https://github.com/wutschel/Official-Kod...rate_nsurl
Reply
#23
Problem still present on iOS 16.1. Except that now it seems it's no longer possible to work around it by disabling cellular in control center — it just changes the repeating error message to the other one ("A data connection is not currently allowed"). 
 
(2022-11-23, 23:07)Buschel Wrote: I was only testing it with an IP, not with a host name.
Then you're unlikely to run into the problem. Especially if it's (m)DNS related. Have we been talking about the same thing?
(2022-11-23, 23:07)Buschel Wrote: As far as I understood (not my code) the 3 lines of code will ping the server after the zeroconf discovery to identify the MAC address for the wake-on-LAN feature.
Ok, but if that's the case, how can you be sure that the zeroconf discovery will return a .local-address (which is currently the only way to recreate the issue) and not simply an IP address? It seems more likely that it would return an IP address, considering there's no guarantee that any one device will have a .local-address anyway. And involving zeroconf — and thereby a running a preferably reliable Kodi instance — in the debug process seems to complicate things unnecessarily, especially since none of that should be needed to run into the issue.
(2022-11-23, 23:07)Buschel Wrote: Does this show an error for you in the debugger? If not, does it show an error after rollback to NSURLConnection? If so, it could be a sign that NSURLConnection is the problem.
Considering the above I'm not yet convinced it's a path worth exploring. So far neither the host VC nor zeroconf has played any part of the issue, to my knowledge. Let me know if you think I've misunderstood anything.

 
Quote:I could now do a really hacky first implementation to check if NSURLSession solves the problem. Can you give this a try: https://github.com/wutschel/Official-Kod...rate_nsurl

Your NSURLSession conversion reminds me very much of the one I wrote yesterday, where I also moved ´connectionDidFinishLoading´ into the completion handler, but you've been a bit more thorough. I'll see if I can test it later. I didn't have much luck with mine — I just got a never ending activity indicator after removing the timeout timer and relying on the request's timeout field (UI eventually crashed seemingly from assumption that the handler was run on main thread, so I suspect a dispatch will be necessary).
Reply
#24
Just updated the branch, now with a lot cleaner implementation, an improved order of requests when connecting first time and also migrating another class to use NSURLSession. Would be great, if you could check, if this works for you. In this case NSURLSession would solve the problem.

Code: https://github.com/wutschel/Official-Kod...rate_nsurl
Reply
#25
I tried your first one, and it seemed to behave the same. Also it crashed with bad access on line 244. Probably due to over-releasing the handler at 272. Commenting out the superfluous lines worked fine (as in no crashes).

I'm still unsure about your tests with IP addresses instead of mDNS hostnames. I think we should clear that up before proceeding any further.
Reply
#26
Retested again, and it seems I screwed up the first test.

A)
- Windows notebook which has Kodi running on a Linux guest. Connected to WiFi router with internet access.
- MacBook with Xcode / simulator connected to the same router
- "Find Kodi" works, can also identify hostname with a small code change
- Connection to Kodi via IP works
- Connection to Kodi via hostname works

B)
- Windows notebook which has Kodi running on a Linux guest. Connected to WiFi router with internet access.
- Notebook provides a WiFi hotspot
- MacBook with Xcode / simulator connected to the WiFi hotspot
- "Find Kodi" fails
- Connection to Kodi via IP works
- Connection to Kodi via hostname fails (messages "Connection Timeout" or "Cannot connect to server...")

When I deactivate the internet access the WiFi hotspot immediately closes. So I cannot test this.

Edit:
Sorry, I am not an expert on this at all. Does this go into the direction of the underlying problem you're having? -> https://stackoverflow.com/questions/4179...onnections
Reply
#27
(2022-11-26, 09:27)Buschel Wrote: A)
- Windows notebook which has Kodi running on a Linux guest. Connected to WiFi router with internet access.
- MacBook with Xcode / simulator connected to the same router
- "Find Kodi" works, can also identify hostname with a small code change
- Connection to Kodi via IP works
- Connection to Kodi via hostname works
  • Running Kodi or not shouldn't matter. Router internet access shouldn't matter.
  • I'm not sure it can be recreated in the simulator, considering the intricacies of needing both a cellular and wifi connection on the device. I've not looked at which wifi configurations are available in the simulator's Settings app. But most importantly: I've never done it. Do you have a device to test on? If not, then I have no idea whether you'll even be able to.
  • "Find Kodi" isn't really relevant for recreating the problem.
  • Connection using IP address is expected to work.
  • Connecting via hostname is a bit ambiguous in that a hostname, among other things, can be both regular DNS (.org, .com) and mDNS (.local). I will assume you've typed in a .local address into the Kodi Remote app here. In any case, important details for recreating the problem are missing, so it's not possible to say whether this is expected to work or not:
    • the wifi configuration (absence of a default router) of the actual device (simulator in this case)
    • whether system-wide cellular is enabled or disabled in control center (should be enabled)
    • app specific cellular access settings (should be disabled)
(2022-11-26, 09:27)Buschel Wrote: B)
- Windows notebook which has Kodi running on a Linux guest. Connected to WiFi router with internet access.
- Notebook provides a WiFi hotspot
- MacBook with Xcode / simulator connected to the WiFi hotspot
- "Find Kodi" fails
- Connection to Kodi via IP works
- Connection to Kodi via hostname fails (messages "Connection Timeout" or "Cannot connect to server...")

When I deactivate the internet access the WiFi hotspot immediately closes. So I cannot test this.
The last line gives me the impression that you're deactivating internet access on the machine providing the hotspot. Internet access on the wifi network should not be relevant for testing. Only iOS device's wifi configuration (and cellular settings) should be relevant.
(2022-11-26, 09:27)Buschel Wrote: Edit:
Sorry, I am not an expert on this at all. Does this go into the direction of the underlying problem you're having? -> https://stackoverflow.com/questions/4179...onnections
That's fine, neither am I. Yes, it touches upon the subject in the answer, but not much more than that.
  • "configuring the network's DHCP server to not provide a router advertisement", "That way, the device won't see a router" — already doing the equivalent of that with manual configuration of iOS's wifi connection.
  • "just rely on [...] zero-conf IPs" already doing that with .local addresses. "Service discovery" should have nothing to do with this since the .local address is input manually and doesn't need to be discovered — only resolved to an IP using mDNS.
Reply
#28
So, finally I get into this state as well. But this is really hard to reach for me.
- Set up WiFi hotspot on the Windows PC which has the Linux guest with Kodi running on it (it *must* be connected to internet to be able to do this)
- Connect my iPhone to this WiFi hotspot
- Status: no problems to connect with either IP or .local
- Disable internet on my WiFi router (just unplugging power)
- Status: no problems to connect with either IP or .local
- Set manual WiFi IP on iPhone, let "router" empty
- Status: here we go -> error popup that there is no internet connection. This is independent of App or system wide cellular data settings.

From here I only get back to normal if I start my WiFi router again and go from there.

Now in simulator I get the same when 
- Set up WiFi hotspot on the Windows PC which has the Linux guest with Kodi running on it (it *must* be connected to internet to be able to do this
- Connect my MacBook to this WiFi hotspot
- Set manual WiFi IP on WLAN setting of MacBook, let "router" empty (did not find this option before)
- Status: here we go -> error popup that there is no internet connection.

And it is confirmed this also happens after the migration to NSURLSession. And the error is reported where expected: URLSession:task:didCompleteWithError: 
Good news, but I still have no idea how to resolve this.
Reply
#29
That makes things easier!

So, to clarify, are you saying that you can't create a hotspot without an internet connection on the laptop, or that you can't recreate the problem in-app without the hotspot laptop having internet access?
Reply
#30
(2022-11-28, 12:54)Appstore-temp Wrote: So, to clarify, are you saying that you can't create a hotspot without an internet connection on the laptop, or that you can't recreate the problem in-app without the hotspot laptop having internet access?
I cannot create a hotspot on the Windows notebook w/o having an internet connection at the time of attempting to create the hotspot. Of course I can switch off the internet after I created the hotspot -- what I did. But in this case the in-app behavior stays the same.

The more promising approach for me is to use the simulator on a MacBook, connected to the hotspot (with internet access), but removing the router from the MacBook's WiFi settings. Will retry this later today, hoping it is still reproducible. In the meanwhile I searched the internet for any hints, searching was about "NSURLSession NURLRequest local network without internet without router". Even though there a quite some threads / comment around similar situations, I am not yet finding the breakthrough hint to resolve this.

Edit:
Sounds like going into the same direction: https://stackoverflow.com/questions/5069...net-access If I understood correct this can only be resolved, if the App introduces its own handling for hotspots and needs to register for this. Then the app could force the URL request to be directed to the WiFi. @kambala, any other possibility you see (except doing all of the network stuff programmatically on low level which I am not aiming for)?

Edit2:
On iPhone I could reproduce the same way, connecting to the Windows hotspot, setting IP manually and leave "router" empty. The other Kodi remote apps I have installed also do not connect. The error message states "No connection to the internet."
Reply

Logout Mark Read Team Forum Stats Members Help
I was asked to describe my setup0