Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25907] Ti.Network.getOnline() messed up unless consoled before

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsengSchedule, ios, simulator, titanium
Reporterjosh.mocek
AssigneeEric Merriman
Created2018-03-22T18:53:34.000+0000
Updated2019-06-25T15:37:44.000+0000

Description

Just create the sample hello world app in appcelerator and use the code below in the index.js file.
function doClick(e) {
	console.info('Ti.Network.online: ' + Ti.Network.getOnline());
	if (Ti.Network.getOnline()) alert($.label.text);
}
$.index.open();
Start the app in an iOS simulator, click 'Hello, World'. The alert should pop up. Then turn off your wifi on your computer, the alert shouldn't pop up. Then turn your wifi back on. If the console.info is uncommented then the alert will work properly. If there is no console then the alert will not pop up.

Comments

  1. Sharif AbuDarda 2018-03-24

    Hello, The issue you described is not clear. In my observation, I see when I turn back my WIFI, I don't get the alert by clicking the label anymore and the console is showing "[INFO] Ti.Network.online: false". But it's not true since I turned on the WIFI. Is this your issue?
  2. josh.mocek 2018-03-26

    yeah, that's my issue
  3. josh.mocek 2018-03-26

    but it fixed it for me if I consoled Ti.Network.getOnline() before it and the alert would then pop up
  4. josh.mocek 2018-09-24

    Any update on this?
  5. josh.mocek 2019-01-04

    Happy new year!

JSON Source