在iOS上更改IP后,使用自定义URL的直接更新不起作用 [英] Direct Update with custom URL not working after IP change on iOS

查看:197
本文介绍了在iOS上更改IP后,使用自定义URL的直接更新不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS上进行直接更新时遇到了一些问题. 以下情况描述了我的问题.

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

  1. 将以下代码段添加到main.js
  2. 在application-descriptor.xml中启用了worklightSettings
  3. 在Worklight开发服务器上运行
  4. 通过Eclipse在Xcode中打开项目
  5. 运行
  6. 进行更改并重新部署
  7. 验证已收到直接更新
  8. 卸载应用
  9. 获取新IP(以我为例,第二天重新启动Macbook)
  10. 通过Eclipse在Xcode中打开项目
  11. 运行
  12. 通过Settings.app打开myapp设置并启用自定义服务器URL.该URL指向旧IP.
  13. 启用自定义服务器URL并输入正确的IP
  14. 打开应用
  15. 未收到直接更新
  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

代码段:

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. 从头开始创建新应用并将其部署在iPad上
  2. 验证自定义服务器的URL并测试直接更新:一切正常(确定)
  3. 更新开发计算机上的ip
  4. 从设备中删除该应用,然后重新安装
  5. 验证自定义服务器的URL:存在旧IP(NOK)
  6. 使用未选中的使用自定义服务器网址启动应用程序=>'连接成功'
  7. 在选中使用自定义服务器网址的情况下启动应用程序(不要更改ip)=>'连接成功'
  8. 尝试使用此ip =>在浏览器中访问应用程序
  9. 更改IP并从自定义服务器网址中删除最后一个斜杠
  10. 使用新的正确IP(在浏览器中可用)启动应用=>'连接成功'
  11. 将IP重新更改为错误的IP,添加斜杠并重试=>否连接成功"
  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'

以前使用过的完全相同的自定义服务器URL现在失败.当我尝试一个随机IP地址时,我也没有获得连接成功"的信息.

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'.

ifconfig的结果:

result of ifconfig:

推荐答案

在Worklight Studio中添加项目时,将输出以下警告消息:

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

FWLPL0010W:当前服务器配置设置为"localhost". 因此,Worklight构建使用此服务器的主要IP地址. 电脑(192.168.1.100)代替.建议设置服务器 配置以使用标准主机名或IP地址 这台电脑.要配置设置,请在服务器"视图中 双击Worklight Development Server条目,然后编辑主机 名称"字段.

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.

在注释中,您说使用了错误的IP地址,因此请按照上述说明尝试更改Worklight Studio选择的默认IP地址.您将设置的地址将用作服务器地址,并在应用程序中使用(您在应用程序设置页面中看到的地址).

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':

  • 从设备/模拟器中删除应用
  • 在Xcode中打开项目时,首先选择清理",然后选择运行"(因为Xcode倾向于保留Settings.bundle文件的缓存)

这篇关于在iOS上更改IP后,使用自定义URL的直接更新不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆