Direct Update with custom URL not working after IP

2019-08-31 00:28发布

I'm having some issues with direct update on iOS. Following scenario describes my problem.

  1. Add the code snippet below to main.js
  2. Enabled worklightSettings in application-descriptor.xml
  3. Run on Worklight Development Server
  4. Open project in Xcode via eclipse
  5. Run
  6. Make a change and re-deploy
  7. Verify Direct Update is received
  8. Uninstall app
  9. Obtain new IP (in my case by restarting my macbook the next day)
  10. Open project in Xcode via eclipse
  11. Run
  12. Open myapp settings via Settings.app and enable Custom Server URL. The URL is pointing to the old IP.
  13. Enable Custom Server URL and enter the correct IP
  14. Open app
  15. Direct Update is not received

Code snippet:

function wlCommonInit(){
    WL.Client.connect({
        onSuccess: onConnectSuccess,
        onFailure: onConnectFailure
    });
}

function onConnectSuccess() {
    WL.Logger.debug("Connect success.");
}

function onConnectFailure() {
    WL.Logger.debug("Connect failed.");
}

EDIT

Try following scenario:

  1. create a new app from scratch and deploy it on your iPad
  2. verify the custom server URL and test direct update: all is working fine (OK)
  3. update the ip on your development machine
  4. remove the app from the device and reinstall it
  5. verify the custom server URL: the old IP is present (NOK)
  6. start the app with the use custom server url unchecked => 'connect success'
  7. start the app with the use custom server url checked (don't change ip) => 'connect success'
  8. try to access the app in your browser with this ip => doesn't work
  9. change the ip and remove the last front slash from the custom server url
  10. start the app with the new correct IP (which works in the browser) => 'connect success'
  11. change the ip back to the incorrect IP, add the slash and retry => NO 'connect success'

The exact same custom server URL which worked before fails now. When I try a random IP address I also don't get the 'connect success'.

EDIT

result of ifconfig:

ifconfig http://i59.tinypic.com/200y2j8.png

1条回答
祖国的老花朵
2楼-- · 2019-08-31 00:50

When you add a project in Worklight Studio, the following warning message is outputted:

FWLPL0010W: The current server configuration is set to "localhost". Therefore the Worklight build uses the primary IP address of this computer (192.168.1.100) instead. It is recommended to set the server configuration to use the fully qualified hostname or IP address of this computer. To configure the setting, in the "Servers" view double-click the Worklight Development Server entry and edit the "Host name" field.

In the comments you say the wrong IP address is used, so try and change the default IP address that Worklight Studio selects by following the above instructions. The address you will set will be used as the server address, as well as be used in the application (the address that you see in the app settings page).

To make sure the settings page is fully 'refreshed':

  • Delete the app from the device/simulator
  • When opening the project in Xcode, first select Clean and then Run (because Xcode tends to keep the Settings.bundle file cached)
查看更多
登录 后发表回答