Ibm mobilefirst 执行cordova仿真时无法连接到服务器

Ibm mobilefirst 执行cordova仿真时无法连接到服务器,ibm-mobilefirst,mobilefirst-server,Ibm Mobilefirst,Mobilefirst Server,我使用该示例将我的应用程序与LDAP连接起来。我可以将应用程序示例连接到服务器。我还可以修改应用程序并连接 问题是,当我将mfp作为插件放入iOS的Cordova项目时,我将该示例放入其中 我可以在MobileBrowserSimulator中看到该应用程序,并可以连接到服务器,但当我执行mfp cordoba仿真时,该应用程序不会连接到服务器 ---更新--- 我使用了与LDAP相同的示例,但它在移动模拟器中运行,但在设备中不起作用。这是一个在模拟器中运行但不在设备中运行的简单示例 main.

我使用该示例将我的应用程序与LDAP连接起来。我可以将应用程序示例连接到服务器。我还可以修改应用程序并连接

问题是,当我将mfp作为插件放入iOS的Cordova项目时,我将该示例放入其中

我可以在MobileBrowserSimulator中看到该应用程序,并可以连接到服务器,但当我执行mfp cordoba仿真时,该应用程序不会连接到服务器

---更新---

我使用了与LDAP相同的示例,但它在移动模拟器中运行,但在设备中不起作用。这是一个在模拟器中运行但不在设备中运行的简单示例

main.js

function getSecretData(){
var request = new WLResourceRequest("/Random/getInteger",
        WLResourceRequest.GET);


request.send().then(onSuccess, onFailure);
}


function onSuccess(r) {
   document.getElementById('guille').innerHTML = r;
}

function onFailure(r) {
     document.getElementById('guille').innerHTML = r;
}
function wlCommonInit(){
    WL.App.setServerUrl("http://127.0.0.1:10080/MyMFPProject",success, fail);
    WL.Client.connect();
}

function success(r){
    document.getElementById('guille').innerHTML = r;
}

function fail(r){
    document.getElementById('guille').innerHTML = "error: " +r;
}

function onSuccess(r) {
 document.getElementById('guille').innerHTML = JSON.stringify(r);
}

function onFailure(r) {
 document.getElementById('guille').innerHTML = JSON.stringify(r);
}
index.js

function getSecretData(){
var request = new WLResourceRequest("/Random/getInteger",
        WLResourceRequest.GET);


request.send().then(onSuccess, onFailure);
}


function onSuccess(r) {
   document.getElementById('guille').innerHTML = r;
}

function onFailure(r) {
     document.getElementById('guille').innerHTML = r;
}
function wlCommonInit(){
    WL.App.setServerUrl("http://127.0.0.1:10080/MyMFPProject",success, fail);
    WL.Client.connect();
}

function success(r){
    document.getElementById('guille').innerHTML = r;
}

function fail(r){
    document.getElementById('guille').innerHTML = "error: " +r;
}

function onSuccess(r) {
 document.getElementById('guille').innerHTML = JSON.stringify(r);
}

function onFailure(r) {
 document.getElementById('guille').innerHTML = JSON.stringify(r);
}

更新:根据评论,似乎ATS仍然处于启用状态,请求将确实失败。通过将以下内容添加到应用程序的*-info.plist中禁用ATS:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>

然后提供您的Cordova项目?它可能将CORs与MF服务器一起使用?这可能会失败。你为什么用一个问题来回答我的问题?!你到底要不要帮忙?解释您遇到的任何错误,提供您的代码并让我们调试。对于错误的代码和不适,我们深表歉意。问题是,应用程序在iOS9中失败,但在IOS8中运行良好。也谢谢你!是否存在在MFP生成WAR文件之前修改web.xml的方法?添加过滤器和过滤器映射。