-
Notifications
You must be signed in to change notification settings - Fork 93
No return from offline on iOS #59
Comments
Wonder if it's related to this: |
Sorry to bump this, I was just wondering if anyone else has seen this - it seems pretty bad, since it renders the whole offline stuff as unusable. I'll try removing cordova and re-building the app, see if that makes a difference. |
Hi Matt, I'm looking at this now, sorry for the delay, we've been focused on 0.5 upcoming. So you are saying that the "online" event code doesn't seem to be working? it accurately goes offline, but never comes online. |
Hi Matt, |
That's weird. I'll try to generate a vanilla app and see if I can recreate. On Tue, 16 Feb 2016 22:23 Jeff Burtoft notifications@github.com wrote:
|
Hi, So I finally got round to testing this. I'm testing on a real iphone 4, which has wifi connection, but no data network (there is no sim card in the phone). I've just generated a new manifoldjs app with this command:
The app generates fine. I build and launch on the device, and then disconnect from the usb cable. Here's what I observe: When I load the app, and then go aeroplane mode, nothing happens until I click a link on the page, at which point I get the offline page (by design?) Here's some output from xcode which may or may not be of use :) When I first go into aeroplane mode:
And again, when I turn OFF aeroplane mode:
Finally, here's the version of the plugins I'm using:
Any ideas? |
Can anyone else confirm these steps produce the same issues as me on a different iphone device - @boyofgreen ? |
Hi Matt, I only have a simulator at this time. @DaveVoyles can you do a base app and test this for Matt. The offline page is suppose to go on by itself when network is lost, so I think there must be something up with network-information @mattwoberts I'll try this with the new version tonight on simulator and see if I get the same issue. |
Hi @boyofgreen. I just tried that app I generated above on the simulator (iphone 6), and it works perfectly. I then tried the same app deployed to another real device. This time it was my wifes iphone 5s. This behaves in much the same way as I reported - aeroplane mode doesn't get picked up until you try to navigate somewhere, and once in offline mode you don't come back. |
bump Anyone else seeing this? |
More updates re: this. I've upgraded everything, so I'm on manifoldjs 0.5.0, but the issue remains. Created a new app as before using this new manifoldjs. Works perfectly on the simulator, but on 3 different test devices, it doesn't work. I tried debugging the app, didn't get too far since i don't know 'owt about objective c, but all I can see is that this isn't being hit:
.. when you're on a real device, although it does get hit when you test on the sim. :( |
I'm going to work round this by disabling the offline support and instead using the notifications from cordova network-information - the javascript notification hooks provided by that plugin are working fine for me, but no events are firing for the offline support added to this plugin. However, I'm confused why no-one else is reporting to see this issue.. @boyofgreen did you manage to test this on a real device? Matt |
I have not yet. This is an interesting one. Clearly there is a bug, but we should also just give you the ability to disable to offline page as a manifest value. |
Did you have to add anything to your info.plist iOS file to get this to run? If I wrap my own site (DaveVoyles.com) then try to run it through my iphone 6 with xCode, it throws an error about "App Transport Security policy requires the use of a secure connection". Thought this SO post would have helped, but no dice. |
So with the latest version of iOS, it is https only by default, but you can go into your plist (I don't remember the value, but I remember it being evident) and allow for http. if you can't find it, I'll crack open an app I did it for and see what it was |
I haven't edited this for my app, my site is https |
@mattwoberts Got it working. I just plugged the phone in and out a bunch and it suddenly removed that error. shrug. Steps taken:
Is that the expected behavior? |
Cheers. Yeah that's the expected behaviour. Does it come back when you turn aeroplane off? So the only difference is that you edited your plist, which shouldn't be an issue for me since I'm HTTPS. |
and he probably has a SIM card in his phone, maybe that is the difference? |
No, it does not come back when I turn airplane mode off and reconnect to the internet. Yes, I have a SIM in this phone as well. |
Thanks Dave. Something must have changed under us. There are a number of iOS issues raised on the tracker . We need to make sure we have it implemented correctly, then raise an issue if need be. |
looks like the issue would be here: |
Hi. I'm testing on both a phone with and without a sim card - same issue on That code you highlight never gets hit for me on iOS when I go On Wed, 2 Mar 2016 16:38 Jeff Burtoft, notifications@github.com wrote:
|
yea, I saw something about the event name changing, maybe we are listening to an old even name |
If I knew anything at all about obj-c I'd take a closer look :) might have a nosey anyway |
I'm in the same boat -- I don't know any obj-c. I agree, looks like it's in the exact spot you mentioned above, but you said it's never hitting that breakpoint, right? |
As you've already noted, it works in the simulator and I'm afraid I don't have a device right now to test this, but if you place a breakpoint in the following line of the Plugins/CDVReachability.m file, does it get hit when the network status changes? |
@mattwoberts would you be able to try that? My guess is that it will run once, but not when it goes back online. |
Yes, it's on my to-do list tonight - I'll get back to you in a couple of hours! |
@boyofgreen @f2bo Hi - just tested, and a breakpoint on that line is never being hit for me - the javascript offline / offline code is firing for me, but never that breakpoint, not even first load. |
Hi @mattwoberts. Interesting. I mentioned placing the breakpoint in the line that actually posts the notification, but just to be sure, can you make sure that the CDVReachabilityCallback method doesn't get called at all? There's some validation code in that method that might cause it to skip the line with the breakpoint. There's another breakpoint that you can set that might help to understand what is going on. Can you put a breakpoint in the sendPluginResult method? Assuming it gets hit, make a note of the call stack leading up to that breakpoint both when transitioning from online to offline and offline to online. (The call stack for all threads can be examined in the Debug navigator pane on the left side of Xcode). Also, I'm intrigued by the fact that you say that the javascript offline / online code is working despite the fact that the notification on the native side never gets fired. Since I can't reproduce the problem in the simulator, I'm trying to understand the code path that needs to execute for that to happen. Presumably, you are hooking the online / offline events with code similar to the following, correct?
|
Hi @f2bo Right - here's my responses. I'm testing on an iphone 4 this time - it's the one that doesn't have a SIM card in it.
Going from online to offline: The stack looks the same going back again - am I looking for anything in particular? Regarding the javascript API - yes absolutely, this is how I'm working around it for now. I listen to the events like this:
And those functions fire perfectly, every time! |
Thanks @mattwoberts , @f2bo and I will be together for the next few weeks and will have some real devices to test with, so we'll figure this out. |
Hi. Just wondered if there was any update / progress on this. I've managed to work around it on my app, so it's not a major issue for me, but I'd ideally prefer to use this... |
Hi Matt, we had to move it out of the 0.3 release (i know it's still tagged) since we didn't want to hold up the other changes with it. We have a 0.4 starting in two weeks, and we'll address it in that release, one way or another. |
Hi @mattwoberts, Sorry it took so long to get back to you but we are currently working on the next release and have started looking at this issue again. I can't tell whether I've been able to reproduce the same symptoms that you report. In my tests, the application does detect changes in network connectivity correctly on a device (iPhone 6s - iOS 9.3) when the application is in the foreground. However, I did find a problem when the changes happen while the application is in the background. I've pushed a potential fix to the ios-offline-fix branch. It would be very helpful if you can test it and let us know if you notice any improvement. The only changed file is src/ios/CDVHostedWebApp.m, so it's probably easiest to test by replacing that file in a copy of your project. Otherwise, you can replace the plugin with the one in the ios-offline-fix branch of this repo. For example:
|
👍 Excellent work - just got round to testing it, and it worked perfectly for me, on all real devices I could find hanging around. Cheers - what release do you think this will be in? |
we are targeting 0.6 for the end of the month, it will be in that one. |
We're building a mobile app using manifoldJS. On iOS, when we lose the network (e.g. airplane mode), and then re-connect, the app never returns from the offline status page.
Just to give you a bit more context, we're using these plugins:
cordova-plugin-crosswalk-webview 1.5.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.1.0 "Device"
cordova-plugin-hostedwebapp 0.2.1 "HostedWebApp"
cordova-plugin-network-information 1.1.0 "Network Information"
cordova-plugin-splashscreen 3.0.0 "Splashscreen"
cordova-plugin-statusbar 2.1.0 "StatusBar"
cordova-plugin-whitelist 1.0.0 "Whitelist"
phonegap-plugin-push 1.4.4 "PushPlugin"
We have our own offline page. We're testing this on 2 separate iphones, an iphone 4 and 6, and see the same issue on both.
iOS version is latest: 9.2.1
The offline mode works fine on android.
Any ideas?
The text was updated successfully, but these errors were encountered: