2

我想在我的 phonegap 应用程序中使用 couchbase lite。它是一个 phonegap 插件,但是当我尝试在波纹中使用它时,我得到:

CBLite.getURL

We seem to be missing some stuff :(

是否可以使用插件或者我是否使用另一个模拟器?(哭泣)

4

1 回答 1

0

如果您使用基于浏览器的(Chrome 扩展)Ripple,请尝试使用 Android 模拟器或 GenyMotion 而不是波纹。

Couchbase Lite 插件提供了一个 URL。您可以在执行 CRUD 操作时使用此 URL。

要在 Cordova(PhoneGap) 上进行快速开发,请尝试以下文章。

  • 您可以使用构建代码c:\APP_FOLDER> cordova build
  • c:\APP_FOLDER> adb devices当您的模拟器运行时,您可以使用 - 只需一次 - 添加您的 ADB模拟器
  • 您可以使用新制造的应用程序替换模拟器上的应用程序adb install -r "platforms\android\ant-build\CordovaApp-debug.apk"

您必须在onDeviceReady活动中编写代码。

警告(2014 年 11 月 18 日之前): 如果您使用beta版本cordova plugin add com.couchbase.lite.phonegap的插件导入了 Cordova Couchbase Lite 插件。必须删除并重新导入使用cordova plugin add https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin.git

希望这有帮助!

var couchbaseLiteURL = "";
var databaseName = "test";

if(window.cblite) {
     window.cblite.getURL(function(err, url) {
            if(err) {
                console.log("error launching Couchbase Lite: " + err);
            } else {
                console.log("Couchbase Lite running at " + url);
                couchbaseLiteURL = url;
            }
     });

} else {
     console.log("error, Couchbase Lite plugin not found.");
}

//jQuery Ajax function
$.ajax(
     url: couchbaseLiteURL + databaseName,
     type: PUT,
     success: function (data, textStatus, xhr) {
          // You can see console output from Chrome Inspect tool chrome://inspect/#devices
          // xhr.status returns a code to you. 
          console.log("success! with status: " + xhr.status); 
     },
     error: function (xhr, statusText, errorThrown) {
          console.log(JSON.stringify(xhr));
     }
);
于 2014-11-17T19:00:25.930 回答