Direct Update with custom URL not working on iOS 7

2019-09-09 16:50发布

问题:

Since my upgrade to WL 6.2 direct update isn't working anymore on iOS. What I'm trying to achieve is to get direct update working with the iPad and my windows machine. This way I can develop on my windows machine and use direct update to push my changes to the iPad (iOS 7.1.2). Following scenario describes my problem.

Create a new WL project in worklight studio on Mac (just installed the latest WL plugin today (platformVersion=6.2.0.00.20140724-2139). Add iOS as environment and replace the main.js with the following code:

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

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

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

Run the project as an Xcode project and use Xcode to deploy the application to an iPad. Now follow the following steps to reproduce the issue:

  1. Make a modification in the index.html
  2. Redeploy the app on your local worklight server in eclipse
  3. Kill your app and restart it again
  4. The direct update is working and your changes are reflected in your app. Yeah!

Now as a very basic next step, try to use the direct update with a Custom Server URL. Thick the Use custom URL checkbox in your iPad settings and change the Custom server URL to the URL of your local server.

Change Server Connectivity Settings http://i59.tinypic.com/35831xx.png

When I now retry step 1 to 3, the direct update fails. On startup the app informs me an update is available, and when I click update the downloading progress bar appears but stays at 0% forever. In the custom server URL I only changed the IP to the IP of my macbook and removed the dash after the project name. I also tried changing the URL to the URL of my windows development machine (also with the latest WL eclipse plugin), but this results in the same behaviour.

One last remark; I would expect that when I disable the Use custom URL checkbox; direct update would work again. But this is not the case.

回答1:

I've tried this and I cannot confirm it not working.

  1. Added your code snippet to main.js
  2. Enabled worklightSettings in application-descriptor.xml
  3. Run on Worklight Development Server
  4. Open project in Xcode
  5. Run
  6. Make a change and re-deploy
  7. Verify Direct Update is received
  8. Quit app
  9. Make a change and re-deploy
  10. Open myapp settings via Settings.app and enable Custom Server URL. The URL is already pointing to my (same) server
  11. Open app
  12. Verify Direct Update is received

You mentioned in the comments that once enabling the Custom Server URL option you also need to change the server address to another - I suggest to double-check you are indeed inputting the correct address. Maybe you have several network cards or alike.



回答2:

Reinstalling eclipse resolved the problem. After reinstalling eclipse I also get the correct IP for the custom server URL in the server connectivity settings.